Skip to content

ci: pin SDK to 8.0.409 and use it in workflow #59

ci: pin SDK to 8.0.409 and use it in workflow

ci: pin SDK to 8.0.409 and use it in workflow #59

Workflow file for this run

name: WinUI Build & Release
on:
push:
branches:
- main
jobs:
build-winui:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.409
- name: Restore
run: dotnet restore winui/Classify.WinUI.sln
- name: Publish WinUI (unpackaged)
run: dotnet publish winui/Classify.WinUI.csproj -c Release -p:Platform=x64 -p:WindowsPackageType=None -p:SelfContained=false -p:PublishSingleFile=false -o out/winui
- name: Install NSIS
run: choco install nsis --yes
- name: Download Windows App Runtime installer
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "winui/installer" | Out-Null
$url = "https://aka.ms/windowsappsdk/1.6/1.6.250602001/windowsappruntimeinstall-x64.exe"
Invoke-WebRequest -Uri $url -OutFile "winui/installer/windowsappruntimeinstall-x64.exe"
- name: Build WinUI NSIS installer
shell: pwsh
run: |
& "C:\Program Files (x86)\NSIS\makensis.exe" "winui/installer/ClassifyWinUI.nsi"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: winui-msix
path: |
out/winui/**
- name: Upload WinUI NSIS installer
uses: actions/upload-artifact@v4
with:
name: winui-nsis
path: winui/installer/ClassifyWinUI-Setup.exe
release:
runs-on: ubuntu-latest
needs:
- build-winui
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.12.0
- name: Get version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: winui-msix
path: artifacts/winui
- name: Download WinUI NSIS installer
uses: actions/download-artifact@v4
with:
name: winui-nsis
path: artifacts/winui-nsis
- name: Archive artifacts
run: |
TAG="v${{ steps.version.outputs.version }}"
ZIP="Classify.WinUI.${{ steps.version.outputs.version }}.zip"
cd artifacts/winui
zip -r "../$ZIP" .
- name: Create or update release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.version.outputs.version }}"
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "Release $TAG already exists."
else
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "$TAG" \
--notes "${{ github.event.head_commit.message }}"
fi
- name: Upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.version.outputs.version }}"
FILE_ZIP="artifacts/Classify.WinUI.${{ steps.version.outputs.version }}.zip"
FILE_NSIS_WINUI="$(find artifacts/winui-nsis -type f -name '*.exe' | head -n1)"
if [ ! -f "$FILE_ZIP" ]; then
echo "Archive $FILE_ZIP not found."
exit 1
fi
if [ -z "$FILE_NSIS_WINUI" ]; then
echo "WinUI NSIS installer not found."
exit 1
fi
gh release upload "$TAG" "$FILE_ZIP" "$FILE_NSIS_WINUI" --repo "$GITHUB_REPOSITORY" --clobber