name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
publish-crate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- name: Verify tag matches package version
shell: bash
run: |
tag_version="${GITHUB_REF_NAME#v}"
package_version="$(awk -F'"' '/^version = / { print $2; exit }' Cargo.toml)"
test "$tag_version" = "$package_version" || {
echo "tag $tag_version does not match Cargo.toml version $package_version" >&2
exit 1
}
- name: Verify package
run: nix develop -c cargo publish --locked --dry-run
- name: Publish to crates.io
run: nix develop -c cargo publish --locked --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
release-binaries:
needs: publish-crate
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-14
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- name: Build lean binary
run: nix develop -c cargo build --release --locked --target ${{ matrix.target }}
- name: Package lean binary
run: tar -czf "asobi-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" asobi
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: |
asobi-${{ matrix.target }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}