Skip to content

Release v1.2.0

Release v1.2.0 #6

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-15
- target: x86_64-apple-darwin
runner: macos-15-intel
- target: aarch64-unknown-linux-musl
runner: ubuntu-24.04-arm
- target: x86_64-unknown-linux-musl
runner: ubuntu-22.04
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl toolchain
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binary
run: cargo build --locked --release --target "${{ matrix.target }}"
- name: Verify embedded version
run: |
expected="${GITHUB_REF_NAME#v}"
actual="$("target/${{ matrix.target }}/release/herdr-switchboard" --version)"
test "$actual" = "herdr-switchboard $expected"
- name: Package binary
shell: bash
run: |
asset="herdr-switchboard-${GITHUB_REF_NAME}-${{ matrix.target }}.tar.gz"
tar -C "target/${{ matrix.target }}/release" -czf "$asset" herdr-switchboard
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: herdr-switchboard-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
if-no-files-found: error
publish:
name: Publish release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create checksums and release notes
shell: bash
run: |
cd dist
sha256sum herdr-switchboard-*.tar.gz >SHA256SUMS
cd ..
version="${GITHUB_REF_NAME#v}"
awk -v want="## [$version]" '
index($0, want) == 1 { found = 1; next }
found && /^## \[/ { exit }
found { print }
' CHANGELOG.md >release-notes.md
test -s release-notes.md
- name: Publish GitHub release with all binaries
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "$GITHUB_REF_NAME"
dist/herdr-switchboard-*.tar.gz dist/SHA256SUMS
--verify-tag --title "$GITHUB_REF_NAME" --notes-file release-notes.md