name: Release artifacts
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Tag to build (e.g. v0.0.3). The tag must already exist."
required: true
permissions:
contents: write
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-apple-darwin
os: macos-15-intel
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: release-${{ matrix.target }}
- name: Build and upload
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: wk
target: ${{ matrix.target }}
archive: $bin-$tag-$target
tar: unix
checksum: sha256
ref: refs/tags/${{ github.event.release.tag_name || inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
installer:
name: Upload install.sh
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- name: Upload install.sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ github.event.release.tag_name || inputs.tag }}"
gh release upload "$tag" install.sh --clobber