Skip to content

## Summary of Changes: #45

## Summary of Changes:

## Summary of Changes: #45

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # v0.2.0-alpha.1, v1.0.0, etc.
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ── macOS universal binary (arm64 + x86_64 via lipo) ──────────────────────
build-macos:
name: Build (macOS universal)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable (+ cross-compile targets)
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin,aarch64-apple-darwin
- name: Cache Cargo registry / build artefacts
uses: Swatinem/rust-cache@v2
- name: Build x86_64
run: cargo build --release --target x86_64-apple-darwin
- name: Build aarch64
run: cargo build --release --target aarch64-apple-darwin
- name: Create universal binary
run: |
lipo -create -output forgiven \
target/x86_64-apple-darwin/release/forgiven \
target/aarch64-apple-darwin/release/forgiven
chmod +x forgiven
tar czf forgiven-${{ github.ref_name }}-apple-darwin-universal.tar.gz forgiven
- uses: actions/upload-artifact@v4
with:
name: macos-universal
path: forgiven-${{ github.ref_name }}-apple-darwin-universal.tar.gz
# ── Linux x86_64 (gnu) ────────────────────────────────────────────────────
build-linux:
name: Build (Linux x86_64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry / build artefacts
uses: Swatinem/rust-cache@v2
- name: Install system dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y \
libxcb1-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev
- name: Build (release)
run: cargo build --release
- name: Package
run: |
chmod +x target/release/forgiven
tar czf forgiven-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz \
-C target/release forgiven
- uses: actions/upload-artifact@v4
with:
name: linux-x86_64
path: forgiven-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz
# ── Windows x86_64 (MSVC) ─────────────────────────────────────────────────
build-windows:
name: Build (Windows x86_64)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry / build artefacts
uses: Swatinem/rust-cache@v2
- name: Build (release)
run: cargo build --release
- name: Package
run: |
Compress-Archive `
-Path target\release\forgiven.exe `
-DestinationPath forgiven-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
- uses: actions/upload-artifact@v4
with:
name: windows-x86_64
path: forgiven-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
# ── Publish GitHub Release ────────────────────────────────────────────────
release:
name: Create GitHub Release
needs: [build-macos, build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # need full history for git log
- name: Download all build artefacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: List artefacts
run: ls -lh dist/
- name: Build release notes from git log
id: notes
run: |
PREV=$(git tag --sort=-version:refname | grep -v "^${{ github.ref_name }}$" | head -1)
if [ -n "$PREV" ]; then
RANGE="${PREV}..${{ github.ref_name }}"
else
RANGE="${{ github.ref_name }}"
fi
NOTES=$(git log "$RANGE" --pretty=format:"- %s" --no-merges)
{
echo 'body<<EOF'
echo "## What's changed"
echo ""
echo "$NOTES"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Publish release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
body: ${{ steps.notes.outputs.body }}
fail_on_unmatched_files: true
files: |
dist/forgiven-*.tar.gz
dist/forgiven-*.zip