Add Updatum auto-update, Azure code signing, version 4.0 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build BabySmash | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore BabySmash.csproj | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v4 | |
| with: | |
| versionSpec: '6.4.x' | |
| - name: GitVersion | |
| uses: gittools/actions/gitversion/execute@v4 | |
| id: gitversion | |
| - name: Set version environment variables | |
| shell: pwsh | |
| run: | | |
| $version = '${{ steps.gitversion.outputs.semVer }}' | |
| $fullVersion = '${{ steps.gitversion.outputs.fullSemVer }}' | |
| $assemblyVersion = "${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}.0" | |
| Write-Host "SemVer: $version" | |
| Write-Host "FullSemVer: $fullVersion" | |
| Write-Host "AssemblyVersion: $assemblyVersion" | |
| echo "VERSION=$version" >> $env:GITHUB_ENV | |
| echo "FULLVERSION=$fullVersion" >> $env:GITHUB_ENV | |
| echo "ASSEMBLY_VERSION=$assemblyVersion" >> $env:GITHUB_ENV | |
| - name: Build | |
| run: dotnet build BabySmash.csproj -c Release --no-restore | |
| - name: Publish x64 | |
| run: | | |
| dotnet publish BabySmash.csproj ` | |
| -c Release ` | |
| -r win-x64 ` | |
| /p:DebugType=None ` | |
| /p:DebugSymbols=false ` | |
| /p:Version=$env:VERSION ` | |
| /p:AssemblyVersion=$env:ASSEMBLY_VERSION ` | |
| /p:FileVersion=$env:ASSEMBLY_VERSION ` | |
| /p:AssemblyInformationalVersion=$env:FULLVERSION ` | |
| --self-contained | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}' | |
| - name: Sign executable with Trusted Signing | |
| uses: azure/trusted-signing-action@v0 | |
| with: | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} | |
| endpoint: https://wus2.codesigning.azure.net/ | |
| trusted-signing-account-name: hanselman | |
| certificate-profile-name: WindowsEdgeLight | |
| files-folder: ${{ github.workspace }}\bin\Release\net10.0-windows\win-x64\publish | |
| files-folder-filter: exe | |
| file-digest: SHA256 | |
| timestamp-rfc3161: http://timestamp.acs.microsoft.com | |
| timestamp-digest: SHA256 | |
| - name: Prepare artifacts | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path artifacts -Force | |
| $version = $env:VERSION | |
| # Create ZIP with exe and README (Updatum needs 2+ files for portable app handling) | |
| New-Item -ItemType Directory -Path "temp-x64" -Force | |
| Copy-Item "bin/Release/net10.0-windows/win-x64/publish/BabySmash.exe" -Destination "temp-x64/" | |
| Copy-Item "README.md" -Destination "temp-x64/" | |
| Compress-Archive -Path "temp-x64/*" -DestinationPath "artifacts/BabySmash-v$version-win-x64.zip" | |
| Remove-Item "temp-x64" -Recurse -Force | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BabySmash-Release | |
| path: artifacts/*.zip | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: artifacts/*.zip | |
| generate_release_notes: true | |
| body: | | |
| ## BabySmash! ${{ github.ref_name }} | |
| A game for babies who like to bang on the keyboard! | |
| ### 📦 Download | |
| | File | Platform | | |
| |------|----------| | |
| | `BabySmash-win-x64.zip` | Intel/AMD 64-bit Windows | | |
| **Self-contained** - Extract and run, no .NET installation required. | |
| ### ⌨️ Usage | |
| - Press keys and watch shapes and letters appear! | |
| - `Ctrl+Shift+Alt+O` - Options | |
| - `Alt+F4` - Exit | |
| --- | |
| append_body: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |