Release 4.0.4 #49
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 tag | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-musl-binaries: | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-musl | |
runner: ubuntu-24.04 | |
- target: aarch64-unknown-linux-musl | |
runner: codspeedhq-arm64-ubuntu-24.04 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: moonrepo/setup-rust@v1 | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install musl tools | |
run: sudo apt-get update && sudo apt-get install -y musl-tools | |
- run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }} | |
- name: Upload binary as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cargo-codspeed-${{ matrix.target }} | |
path: ./target/${{ matrix.target }}/release/cargo-codspeed | |
if-no-files-found: error | |
publish: | |
needs: build-musl-binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: moonrepo/setup-rust@v0 | |
with: | |
cache-target: release | |
bins: cargo-workspaces | |
- name: Build | |
run: cargo build --release | |
- name: Publish package | |
if: github.event_name != 'workflow_dispatch' | |
run: cargo workspaces publish --from-git | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
- name: Create a draft release | |
id: create_release | |
if: github.event_name != 'workflow_dispatch' | |
run: | | |
NEW_VERSION=$(cargo workspaces ls --json | jq -r '.[] | select(.name == "codspeed") | .version') | |
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d | |
echo "upload_url=$(gh release view v$NEW_VERSION --json uploadUrl | jq -r '.uploadUrl')" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
upload-binaries: | |
needs: publish | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-musl | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download binary artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: cargo-codspeed-${{ matrix.target }} | |
path: ./target/${{ matrix.target }}/release | |
- name: Upload Release Asset | |
if: github.event_name != 'workflow_dispatch' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.publish.outputs.upload_url }} | |
asset_path: ./target/${{ matrix.target }}/release/cargo-codspeed | |
asset_name: cargo-codspeed-${{ matrix.target }} | |
asset_content_type: application/octet-stream |