name: Release on: push: branches: [master] workflow_dispatch: permissions: contents: write pull-requests: write env: CARGO_TERM_COLOR: always jobs: # Opens (or updates) a "chore: release vX.Y.Z" PR with the version bump and # changelog derived from the conventional commits on master. Merging it is the # release trigger. release-pr: name: Release PR runs-on: ubuntu-latest concurrency: group: release-pr-${{ github.ref }} cancel-in-progress: false steps: - uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - uses: dtolnay/rust-toolchain@stable - uses: release-plz/action@v0.5 with: command: release-pr env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} # No-op until the release PR lands; then tags, publishes both crates to # crates.io in dependency order, and creates the GitHub release. release: name: Tag and publish runs-on: ubuntu-latest concurrency: group: release-${{ github.ref }} cancel-in-progress: false outputs: created: ${{ steps.release-plz.outputs.releases_created }} tag: ${{ steps.tag.outputs.tag }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 persist-credentials: false - uses: dtolnay/rust-toolchain@stable - uses: release-plz/action@v0.5 id: release-plz with: command: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} # Read the tag out via jq rather than fromJSON: `releases` is an empty # string on the runs where nothing was released, and fromJSON chokes on it. - name: Resolve tag id: tag if: steps.release-plz.outputs.releases_created == 'true' env: RELEASES: ${{ steps.release-plz.outputs.releases }} run: echo "tag=$(jq -r '.[0].tag' <<< "$RELEASES")" >> "$GITHUB_OUTPUT" # Attaches downloadable binaries to the release GitHub just created. binaries: name: ${{ matrix.target }} needs: release if: needs.release.outputs.created == 'true' runs-on: ${{ matrix.os }} strategy: # One flaky cross-linker must not hold back the five targets that built. fail-fast: false matrix: include: - target: x86_64-unknown-linux-musl os: ubuntu-latest - target: aarch64-unknown-linux-musl os: ubuntu-24.04-arm - target: x86_64-apple-darwin os: macos-latest - target: aarch64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc os: windows-latest - target: aarch64-pc-windows-msvc os: windows-latest steps: - uses: actions/checkout@v4 with: ref: ${{ needs.release.outputs.tag }} - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install musl toolchain if: endsWith(matrix.target, '-musl') run: sudo apt-get update && sudo apt-get install -y musl-tools # Builds, strips, archives (.tar.gz / .zip on Windows), writes a .sha256 # and uploads the lot to the release. - uses: taiki-e/upload-rust-binary-action@v1 with: bin: soulseek-rs target: ${{ matrix.target }} archive: $bin-$tag-$target include: README.md,LICENSE checksum: sha256 ref: refs/tags/${{ needs.release.outputs.tag }} token: ${{ secrets.GITHUB_TOKEN }}