name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Ensure the release exists
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "${GITHUB_REF_NAME}" --repo "$GITHUB_REPOSITORY" \
|| gh release create "${GITHUB_REF_NAME}" --repo "$GITHUB_REPOSITORY" \
--title "${GITHUB_REF_NAME}" --verify-tag --generate-notes
binaries:
needs: create-release
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: macos-13, target: x86_64-apple-darwin }
- { os: macos-14, target: aarch64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
steps:
- uses: actions/checkout@v4
- name: Install Rust target
run: rustup update stable && rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package
run: tar -C "target/${{ matrix.target }}/release" -czf "yardlet-${{ matrix.target }}.tar.gz" yardlet
- name: Upload to release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${GITHUB_REF_NAME}" "yardlet-${{ matrix.target }}.tar.gz" --repo "$GITHUB_REPOSITORY" --clobber