Build Release Assets #12
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 Release Assets | |
| on: | |
| workflow_dispatch: # Manual trigger for testing | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for testing (e.g., v0.0.1-test)' | |
| required: true | |
| default: 'v0.0.1-test' | |
| skip_upload: | |
| description: 'Skip upload (test build only)' | |
| required: false | |
| default: false | |
| type: boolean | |
| release: | |
| types: [created] | |
| jobs: | |
| # Job 1: Build only (no write permissions, no tokens) | |
| build: | |
| name: Build ${{ matrix.suffix }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| # macOS builds | |
| - runner: macos-latest | |
| binary_platform: MacOS(:x86_64) | |
| suffix: -macos-x86_64.dmg | |
| prefix: "" # Default empty prefix | |
| - runner: macos-latest | |
| binary_platform: MacOS(:aarch64) | |
| suffix: -macos-aarch64.dmg | |
| prefix: "" # Default empty prefix | |
| # Linux builds | |
| - runner: ubuntu-latest | |
| binary_platform: Linux(:x86_64) | |
| suffix: -linux-x86_64.snap | |
| prefix: xvfb-run -s '-screen 0 1024x768x24' | |
| - runner: ubuntu-24.04-arm | |
| binary_platform: Linux(:aarch64) | |
| suffix: -linux-aarch64.snap | |
| prefix: xvfb-run -s '-screen 0 1024x768x24' | |
| # Windows builds | |
| - runner: windows-latest | |
| binary_platform: Windows(:x86_64) | |
| suffix: -windows-x86_64.msix | |
| prefix: "" # Default empty prefix | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Julia | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: '1.11.6' | |
| - name: Cache Julia packages | |
| uses: julia-actions/cache@v1 | |
| - name: Install AppBundler | |
| run: julia --project=meta -e 'using Pkg; Pkg.instantiate()' | |
| - name: Build installer | |
| env: | |
| MACOS_PFX_PASSWORD: ${{ secrets.MACOS_PFX_PASSWORD }} | |
| WINDOWS_PFX_PASSWORD: ${{ secrets.WINDOWS_PFX_PASSWORD }} | |
| run: | | |
| mkdir -p build | |
| ${{ matrix.prefix }} julia --project=meta -e 'using AppBundler; using Pkg.BinaryPlatforms; AppBundler.build_app(${{ matrix.binary_platform }}, pwd(), "build/peacefounder${{ matrix.suffix }}", precompile=true, incremental=false)' | |
| # Store the built file as an artifact | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: peacefounder${{ matrix.suffix }} | |
| path: build/peacefounder${{ matrix.suffix }} | |
| retention-days: 1 | |
| # Job 2: Upload all artifacts in a single job | |
| upload: | |
| name: Upload to release | |
| runs-on: ubuntu-latest | |
| needs: build # Waits for build jobs to complete | |
| if: github.event.inputs.skip_upload != 'true' # Skip if testing build only | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Upload all artifacts to release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| # Use manual tag name if workflow_dispatch, otherwise use release tag | |
| TAG_NAME="${{ github.event.inputs.tag_name || github.event.release.tag_name }}" | |
| echo "Uploading to release: $TAG_NAME" | |
| # Find and upload all files in artifacts directory | |
| find artifacts/ -type f | while read -r file; do | |
| echo "Uploading: $file" | |
| gh release upload "$TAG_NAME" "$file" | |
| done | |
| echo "All artifacts uploaded successfully!" |