Release #99
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*' | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Release tag (e.g. v1.0.0) - used only when triggered manually' | |
| required: true | |
| jobs: | |
| # ────────────────────────────────────── LINUX ────────────────────────────────────── | |
| build_linux: | |
| uses: ./.github/workflows/release-linux.yml | |
| permissions: | |
| contents: read | |
| # ────────────────────────────────────── WINDOWS ──────────────────────────────────── | |
| build_windows: | |
| uses: ./.github/workflows/release-windows.yml | |
| permissions: | |
| contents: read | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} | |
| # ────────────────────────────────────── MACOS ────────────────────────────────────── | |
| build_mac: | |
| uses: ./.github/workflows/release-mac.yml | |
| permissions: | |
| contents: read | |
| # ────────────────────────────────────── WASM ────────────────────────────────────── | |
| build_wasm: | |
| uses: ./.github/workflows/release-wasm.yml | |
| permissions: | |
| contents: read | |
| # ────────────────────────────────────── PUBLISH ──────────────────────────────────── | |
| publish: | |
| needs: [build_linux, build_windows, build_mac, build_wasm] | |
| runs-on: ubuntu-latest | |
| # Run whenever the three main platform builds succeed, even if the WASM build failed | |
| if: | | |
| always() && | |
| needs.build_linux.result == 'success' && | |
| needs.build_windows.result == 'success' && | |
| needs.build_mac.result == 'success' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download Linux AppImage | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-appimage | |
| - name: Download Windows zip | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-zip | |
| - name: Download Windows MSI | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-msi | |
| - name: Download macOS dmg | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-dmg | |
| - name: Download Wasm zip | |
| id: download_wasm | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| name: wasm-zip | |
| - name: Checkout repo (for docs/app deploy) | |
| uses: actions/checkout@v4 | |
| with: | |
| path: repo | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Deploy Wasm files to docs/app/ | |
| if: steps.download_wasm.outcome == 'success' | |
| run: | | |
| mkdir -p repo/docs/app | |
| unzip -o MaximumTrainer-wasm.zip -d repo/docs/app/ | |
| cd repo | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/app/ | |
| git diff --cached --quiet || git commit -m "chore: deploy Wasm build artifacts for ${{ github.ref_name }}" | |
| git push origin HEAD:refs/heads/master | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} | |
| generate_release_notes: true | |
| fail_on_unmatched_files: false | |
| # Don't try to delete/overwrite existing assets - attempting to delete | |
| # assets from an immutable release causes a fatal API error. | |
| overwrite_files: false | |
| files: | | |
| MaximumTrainer-linux-x86_64.AppImage | |
| MaximumTrainer-windows-x64.zip | |
| MaximumTrainer-windows-x64.msi | |
| MaximumTrainer-macos.dmg | |
| MaximumTrainer-wasm.zip | |
| # ────────────────────────────────────── VERIFY ───────────────────────────────────── | |
| verify_assets: | |
| needs: publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Verify release assets are downloadable | |
| run: | | |
| REPO="${{ github.repository }}" | |
| mkdir -p /tmp/release-assets | |
| cd /tmp/release-assets | |
| echo "Verifying release assets for tag: $TAG" | |
| # Required assets – the job fails if any of these are missing or empty | |
| REQUIRED=( | |
| "MaximumTrainer-linux-x86_64.AppImage" | |
| "MaximumTrainer-windows-x64.zip" | |
| "MaximumTrainer-windows-x64.msi" | |
| "MaximumTrainer-macos.dmg" | |
| ) | |
| for asset in "${REQUIRED[@]}"; do | |
| echo "Downloading $asset ..." | |
| gh release download "$TAG" --repo "$REPO" --pattern "$asset" | |
| if [ ! -s "$asset" ]; then | |
| echo "ERROR: $asset is missing or empty in release $TAG" | |
| exit 1 | |
| fi | |
| SIZE=$(stat -c%s "$asset") | |
| echo "✓ $asset (${SIZE} bytes)" | |
| done | |
| # WASM asset is best-effort: warn but do not fail if absent | |
| echo "Checking optional WASM asset ..." | |
| if gh release download "$TAG" --repo "$REPO" --pattern "MaximumTrainer-wasm.zip" 2>/dev/null; then | |
| if [ -s "MaximumTrainer-wasm.zip" ]; then | |
| SIZE=$(stat -c%s "MaximumTrainer-wasm.zip") | |
| echo "✓ MaximumTrainer-wasm.zip (${SIZE} bytes)" | |
| else | |
| echo "WARNING: MaximumTrainer-wasm.zip is present but empty" | |
| fi | |
| else | |
| echo "NOTE: MaximumTrainer-wasm.zip not found in release (Wasm build is best-effort)" | |
| fi | |
| echo "" | |
| echo "All required release assets are present and downloadable." |