name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-release:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Validate tag ref
if: github.ref_type != 'tag'
run: |
echo "::error::Release workflow must be triggered by a tag push, not a branch."
exit 1
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 with:
targets: ${{ matrix.target }}
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install -y musl-tools
- uses: Swatinem/rust-cache@401aff9a7a08acb9d27b64936a90db81024cff97
- name: Upload binary to release
uses: taiki-e/upload-rust-binary-action@57510bf386b3945b57963e73201cea60ca18dff4 with:
bin: toggle
target: ${{ matrix.target }}
tar: unix
zip: windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}