name: release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
archive_ext: tar.gz
- target: aarch64-apple-darwin
runner: macos-latest
archive_ext: tar.gz
- target: x86_64-apple-darwin
runner: macos-latest
archive_ext: tar.gz
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --locked --release --target ${{ matrix.target }}
- name: Stage binary + docs
run: |
set -euo pipefail
stage="ebman-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir "$stage"
cp "target/${{ matrix.target }}/release/ebman" "$stage/"
cp README.md LICENSE-MIT LICENSE-APACHE "$stage/"
tar -czf "$stage.tar.gz" "$stage"
shasum -a 256 "$stage.tar.gz" | tee "$stage.tar.gz.sha256"
- name: Upload as workflow artifact
uses: actions/upload-artifact@v4
with:
name: ebman-${{ matrix.target }}
path: |
ebman-*.tar.gz
ebman-*.tar.gz.sha256
publish:
name: publish release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
pattern: ebman-*
merge-multiple: true
- name: Attach artefacts to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ebman ${{ github.ref_name }}
files: |
dist/ebman-*.tar.gz
dist/ebman-*.tar.gz.sha256
draft: true
generate_release_notes: true