Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 38 additions & 63 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,88 @@
name: Publish Preview NuGet Package
name: Publish Development Preview NuGet Package

permissions:
contents: write # needed to push tags and commits
packages: write # optional – good practice when publishing packages
contents: read
packages: write

on:
push:
branches:
- development # run on merge to develop (if you have a develop branch)
- development

jobs:
build_and_publish:
build_and_publish_preview:
runs-on: ubuntu-latest

steps:
# Checkout repository
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch full history for tags

# Setup Git for committing and tagging
- name: Set up Git
# Extract base version from CHANGELOG.md
- name: Extract version from CHANGELOG.md
id: extract_version
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
if [ ! -f CHANGELOG.md ]; then
echo "❌ CHANGELOG.md not found!"
exit 1
fi

BASE_VERSION=$(grep -m1 -oP '(?<=## \[)[^]]+' CHANGELOG.md)

if [ -z "$BASE_VERSION" ]; then
echo "❌ Could not extract version from CHANGELOG.md"
exit 1
fi

SHORT_SHA=$(git rev-parse --short HEAD)

PREVIEW_VERSION="${BASE_VERSION}-preview.${SHORT_SHA}"

echo "Preview version: $PREVIEW_VERSION"
echo "VERSION=$PREVIEW_VERSION" >> $GITHUB_ENV

# Setup .NET
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

# Bump preview version
- name: Bump preview version
run: |
CSPROJS=(
"./RisShaderToolkit/RisShaderToolkit/RisShaderToolkit.csproj"
)
for csproj in "${CSPROJS[@]}"; do
echo "Processing $csproj"
CURRENT_VERSION=$(grep -oP '(?<=<Version>).*?(?=</Version>)' "$csproj")
if [[ -z "$CURRENT_VERSION" ]]; then
echo "Warning: No <Version> found in $csproj"
continue
fi
PREVIEW_NUMBER=$(echo "$CURRENT_VERSION" | grep -oP '(?<=-preview\.)\d+' || echo "0")
NEW_PREVIEW_NUMBER=$((PREVIEW_NUMBER + 1))
NEW_VERSION=$(echo "$CURRENT_VERSION" | sed -E "s/(.*-preview\.)[0-9]+/\1$NEW_PREVIEW_NUMBER/")
if [[ "$CURRENT_VERSION" != *"-preview."* ]]; then
NEW_VERSION="${CURRENT_VERSION}-preview.1"
fi
echo "Bumping $CURRENT_VERSION → $NEW_VERSION in $csproj"
sed -i "s#<Version>.*</Version>#<Version>$NEW_VERSION</Version>#g" "$csproj"
git add "$csproj"
done
git commit -m "Bump preview version to $NEW_VERSION" || echo "No changes to commit"
git push origin development || echo "Push failed (maybe no changes)"
echo "VERSION=$NEW_VERSION" >> "$GITHUB_ENV"

# Build
- name: Build
run: dotnet build ./RisShaderToolkit/RisShaderToolkit.sln --configuration Release

# Pack
# Pack with preview version
- name: Pack
run: dotnet pack ./RisShaderToolkit/RisShaderToolkit.sln --configuration Release --no-build
run: |
dotnet pack ./RisShaderToolkit/RisShaderToolkit.sln \
--configuration Release \
--no-build \
/p:PackageVersion=${{ env.VERSION }}

# Find NuGet package
- name: Find NuGet packages
id: find_pkgs
run: |
mapfile -t packages < <(find ./RisShaderToolkit -name "*.nupkg" ! -name "*symbols*.nupkg")

if [ ${#packages[@]} -eq 0 ]; then
echo "Error: No .nupkg files found!"
echo " No .nupkg files found!"
exit 1
fi

{
echo "packages<<EOF"
printf '%s\n' "${packages[@]}"
echo "EOF"
} >> $GITHUB_OUTPUT

# Publish to NuGet
- name: Publish all NuGet packages
# Publish preview packages
- name: Publish preview NuGet packages
run: |
while IFS= read -r pkg; do
[[ -z "$pkg" ]] && continue
echo "Publishing $pkg"
echo "Publishing preview $pkg"
dotnet nuget push "$pkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done <<< "${{ steps.find_pkgs.outputs.packages }}"

- name: Create and push git tag
run: |
git tag "v${{ env.VERSION }}"
git push origin "v${{ env.VERSION }}"

# Create GitHub Release
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}
name: Preview ${{ env.VERSION }}
draft: false
prerelease: true
generate_release_notes: true
files: |
${{ steps.find_pkgs.outputs.packages }}
overwrite: true # equivalent to overwrite_files: true in newer versions
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.2.0] - 2026-03-21

### Added
- `Slang` to `glsl` shader compilation is now supported.
- `CompileSlangToGlsl` method was added to the `ShaderCompiler`.

## [0.1.0] - 2026-03-04

### Added
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ The toolkit consists of two main parts:
- Provides easy-to-use methods for compiling Slang shaders into multiple target formats:
- WGSL
- SPIR-V
- GLSL
- possibly others in the future

- Published as **NuGet package(s)**
- Used by **RisGameFramework** but can be used by any other .NET project

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions RisShaderToolkit/RisGameFramework.ShaderToolkit.Client/App.axaml

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Loading
Loading