This repository was archived by the owner on Aug 17, 2026. It is now read-only.
fix(ci): restore release workflow runners #8
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*.*.*' | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BIN_NAME: why | |
| PACKAGE_NAME: why-core | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| use-cross: true | |
| archive-suffix: linux-x86_64 | |
| archive-ext: tar.gz | |
| binary-name: why | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| use-cross: true | |
| archive-suffix: linux-aarch64 | |
| archive-ext: tar.gz | |
| binary-name: why | |
| - target: x86_64-apple-darwin | |
| os: macos-15-intel | |
| use-cross: false | |
| archive-suffix: macos-x86_64 | |
| archive-ext: tar.gz | |
| binary-name: why | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| use-cross: false | |
| archive-suffix: macos-aarch64 | |
| archive-ext: tar.gz | |
| binary-name: why | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| use-cross: false | |
| archive-suffix: windows-x86_64 | |
| archive-ext: zip | |
| binary-name: why.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cross | |
| if: matrix.use-cross | |
| uses: taiki-e/install-action@cross | |
| - name: Build binary with cross | |
| if: matrix.use-cross | |
| run: cross build --release --locked --package "$PACKAGE_NAME" --bin "$BIN_NAME" --target "${{ matrix.target }}" | |
| - name: Build binary natively | |
| if: ${{ !matrix.use-cross }} | |
| shell: bash | |
| run: cargo build --release --locked --package "$PACKAGE_NAME" --bin "$BIN_NAME" --target "${{ matrix.target }}" | |
| - name: Package Unix archive | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| VERSION="${GITHUB_REF_NAME}" | |
| STAGE_DIR="dist/${BIN_NAME}-${VERSION}-${{ matrix.archive-suffix }}" | |
| mkdir -p "$STAGE_DIR" | |
| cp "target/${{ matrix.target }}/release/${{ matrix.binary-name }}" "$STAGE_DIR/${BIN_NAME}" | |
| tar -C dist -czf "dist/${BIN_NAME}-${VERSION}-${{ matrix.archive-suffix }}.tar.gz" "${BIN_NAME}-${VERSION}-${{ matrix.archive-suffix }}" | |
| shasum -a 256 "dist/${BIN_NAME}-${VERSION}-${{ matrix.archive-suffix }}.tar.gz" | awk '{print $1}' > "dist/${BIN_NAME}-${VERSION}-${{ matrix.archive-suffix }}.tar.gz.sha256" | |
| - name: Package Windows archive | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $version = "$env:GITHUB_REF_NAME" | |
| $stageDir = "dist/${env:BIN_NAME}-$version-${{ matrix.archive-suffix }}" | |
| New-Item -ItemType Directory -Force -Path $stageDir | Out-Null | |
| Copy-Item "target/${{ matrix.target }}/release/${{ matrix.binary-name }}" "$stageDir/${{ matrix.binary-name }}" | |
| Compress-Archive -Path "$stageDir/*" -DestinationPath "dist/${env:BIN_NAME}-$version-${{ matrix.archive-suffix }}.zip" -Force | |
| $hash = (Get-FileHash "dist/${env:BIN_NAME}-$version-${{ matrix.archive-suffix }}.zip" -Algorithm SHA256).Hash.ToLower() | |
| Set-Content -Path "dist/${env:BIN_NAME}-$version-${{ matrix.archive-suffix }}.zip.sha256" -Value $hash | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.target }} | |
| path: | | |
| dist/*.tar.gz | |
| dist/*.tar.gz.sha256 | |
| dist/*.zip | |
| dist/*.zip.sha256 | |
| release: | |
| name: Publish GitHub release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artifacts/*.tar.gz | |
| artifacts/*.tar.gz.sha256 | |
| artifacts/*.zip | |
| artifacts/*.zip.sha256 |