Release #14
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-macos: | |
| runs-on: macos-26 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check build environment | |
| run: | | |
| sw_vers | |
| xcodebuild -version | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update app version | |
| run: | | |
| VERSION=${{ steps.version.outputs.VERSION }} | |
| sed -i '' "s/MARKETING_VERSION = .*/MARKETING_VERSION = $VERSION;/" KeyStats.xcodeproj/project.pbxproj | |
| echo "Updated MARKETING_VERSION to $VERSION" | |
| - name: Build DMG | |
| run: ./scripts/build_dmg.sh | |
| - name: Calculate SHA256 | |
| id: sha256 | |
| run: echo "SHA256=$(shasum -a 256 KeyStats.dmg | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-dmg | |
| path: KeyStats.dmg | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| sha256: ${{ steps.sha256.outputs.SHA256 }} | |
| build-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| shell: bash | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Update app version | |
| shell: pwsh | |
| run: | | |
| $csprojPath = "KeyStats.Windows/KeyStats/KeyStats.csproj" | |
| $version = "${{ steps.version.outputs.VERSION }}" | |
| (Get-Content $csprojPath) -replace '<Version>.*</Version>', "<Version>$version</Version>" | Set-Content $csprojPath | |
| Write-Host "Updated Version to $version" | |
| - name: Build Windows app | |
| shell: pwsh | |
| working-directory: KeyStats.Windows | |
| run: | | |
| .\build.ps1 -Configuration Release | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: KeyStats.Windows/dist/*.zip | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| create-release: | |
| needs: [build-macos, build-windows] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download macOS artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-dmg | |
| - name: Download Windows artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-zip | |
| - name: List artifacts | |
| run: ls -la | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| KeyStats.dmg | |
| *.zip | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Homebrew Tap | |
| env: | |
| TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} | |
| run: | | |
| git clone https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/debugtheworldbot/homebrew-keystats.git /tmp/homebrew-keystats | |
| cd /tmp/homebrew-keystats | |
| sed -i "s/version \".*\"/version \"${{ needs.build-macos.outputs.version }}\"/" Casks/keystats.rb | |
| sed -i "s/sha256 \".*\"/sha256 \"${{ needs.build-macos.outputs.sha256 }}\"/" Casks/keystats.rb | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Casks/keystats.rb | |
| git commit -m "chore: update keystats to v${{ needs.build-macos.outputs.version }}" | |
| git push origin main | |
| - name: Verify Release | |
| if: success() | |
| run: | | |
| echo "✅ Release v${{ needs.build-macos.outputs.version }} created successfully" | |
| echo "✅ macOS DMG SHA256: ${{ needs.build-macos.outputs.sha256 }}" | |
| echo "✅ Windows ZIP uploaded" | |
| echo "✅ Homebrew tap updated" |