Release #8
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: | |
| create_release: | |
| description: "Create a draft GitHub Release from build artifacts" | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: "0" | |
| RUST_BACKTRACE: "1" | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: macOS aarch64 | |
| os: macos-14 | |
| target: aarch64-apple-darwin | |
| artifact: terry-macos-aarch64 | |
| package: macos | |
| # Temporarily disabled — re-enable when Intel Mac packaging is needed again. | |
| # - name: macOS x86_64 | |
| # os: macos-13 | |
| # target: x86_64-apple-darwin | |
| # artifact: terry-macos-x86_64 | |
| # package: macos | |
| - name: Linux x86_64 | |
| os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| artifact: terry-linux-x86_64 | |
| package: linux | |
| - name: Windows x86_64 | |
| os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact: terry-windows-x86_64 | |
| package: windows | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Prepare Windows build environment | |
| if: matrix.package == 'windows' | |
| shell: pwsh | |
| run: | | |
| # Required for pet/python-environment-tools git checkouts (MAX_PATH). | |
| git config --system core.longpaths true | |
| git config --global core.longpaths true | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" ` | |
| -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | Out-Null | |
| # wasmtime / native deps expect cmake on PATH. | |
| if (-not (Get-Command cmake -ErrorAction SilentlyContinue)) { | |
| choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y | |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + | |
| [System.Environment]::GetEnvironmentVariable("Path","User") | |
| } | |
| cmake --version | |
| - name: Install Linux dependencies | |
| if: matrix.package == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ | |
| build-essential \ | |
| clang \ | |
| cmake \ | |
| curl \ | |
| git \ | |
| jq \ | |
| libasound2-dev \ | |
| libfontconfig-dev \ | |
| libsqlite3-dev \ | |
| libssl-dev \ | |
| libwayland-dev \ | |
| libx11-dev \ | |
| libxcb-xfixes0-dev \ | |
| libxkbcommon-dev \ | |
| libxkbcommon-x11-dev \ | |
| libzstd-dev \ | |
| libvulkan-dev \ | |
| pkg-config | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: "1.95.0" | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: release-${{ matrix.target }} | |
| cache-targets: true | |
| - name: Resolve version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| else | |
| VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" | |
| VERSION="${VERSION:-0.0.0}+${GITHUB_SHA::7}" | |
| fi | |
| # Zip/path-safe form (avoid '+' in Windows filenames). | |
| VERSION_SAFE="${VERSION//+/-}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "version_safe=$VERSION_SAFE" >> "$GITHUB_OUTPUT" | |
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
| echo "VERSION_SAFE=$VERSION_SAFE" >> "$GITHUB_ENV" | |
| - name: Package macOS | |
| if: matrix.package == 'macos' | |
| shell: bash | |
| run: | | |
| chmod +x script/package-macos.sh | |
| ZIP="$(script/package-macos.sh "${{ matrix.target }}" | tee /dev/stderr | tail -n 1)" | |
| mkdir -p dist | |
| cp -f "$ZIP" dist/ | |
| - name: Package Linux | |
| if: matrix.package == 'linux' | |
| shell: bash | |
| run: | | |
| chmod +x script/package-linux.sh | |
| ARCHIVE="$(script/package-linux.sh "${{ matrix.target }}" | tee /dev/stderr | tail -n 1)" | |
| mkdir -p dist | |
| cp -f "$ARCHIVE" dist/ | |
| - name: Package Windows | |
| if: matrix.package == 'windows' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = "Stop" | |
| $version = if ($env:VERSION_SAFE) { $env:VERSION_SAFE } else { $env:VERSION } | |
| $zip = & ".\script\package-windows.ps1" -Target "${{ matrix.target }}" -Version $version | |
| if (-not $zip) { throw "package-windows.ps1 produced no zip path" } | |
| if ($zip -is [array]) { $zip = ($zip | Where-Object { $_ })[-1] } | |
| Write-Host "Artifact: $zip" | |
| if (-not (Test-Path $zip)) { throw "Zip not found: $zip" } | |
| New-Item -ItemType Directory -Force -Path dist | Out-Null | |
| Copy-Item -Force $zip dist/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: dist/* | |
| if-no-files-found: error | |
| retention-days: 14 | |
| release: | |
| name: Publish GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: | | |
| always() && | |
| needs.build.result == 'success' && | |
| ( | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) || | |
| (github.event_name == 'workflow_dispatch' && inputs.create_release == true) | |
| ) | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: find artifacts -type f | sort | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('build-{0}', github.run_id) }} | |
| name: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('Terry build {0}', github.run_id) }} | |
| draft: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
| generate_release_notes: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| files: artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |