Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin_ext: ""
- os: macos-13
target: x86_64-apple-darwin
bin_ext: ""
- os: macos-14
target: aarch64-apple-darwin
bin_ext: ""
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package archive
shell: bash
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME}"
DIST_DIR="funee-${VERSION}-${{ matrix.target }}"
mkdir -p "${DIST_DIR}/bin"
cp "target/${{ matrix.target }}/release/funee${{ matrix.bin_ext }}" "${DIST_DIR}/bin/funee${{ matrix.bin_ext }}"
cp -R funee-lib "${DIST_DIR}/funee-lib"
tar -czf "${DIST_DIR}.tar.gz" "${DIST_DIR}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.target }}
path: funee-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
publish:
name: Publish Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Generate checksums
run: |
set -euo pipefail
find dist -type f -name "*.tar.gz" -print0 | sort -z | xargs -0 sha256sum > dist/checksums.txt
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.tar.gz
dist/checksums.txt