name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: my-ci-x86_64-linux
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
artifact: my-ci-aarch64-linux
- target: aarch64-apple-darwin
os: macos-latest
artifact: my-ci-aarch64-macos
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: my-ci-x86_64-windows
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build UI
run: bun install --frozen-lockfile && bun run build
working-directory: ui
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Stage release tree
shell: bash
run: |
mkdir -p "dist/${{ matrix.artifact }}/ui"
cp -R ui/dist "dist/${{ matrix.artifact }}/ui/dist"
- name: Package (unix)
if: runner.os != 'Windows'
shell: bash
run: |
cp "target/${{ matrix.target }}/release/my-ci" "dist/${{ matrix.artifact }}/"
tar czf "${{ matrix.artifact }}.tar.gz" -C dist "${{ matrix.artifact }}"
- name: Package (windows)
if: runner.os == 'Windows'
shell: bash
run: |
cp "target/${{ matrix.target }}/release/my-ci.exe" "dist/${{ matrix.artifact }}/"
(cd dist && 7z a "../${{ matrix.artifact }}.zip" "${{ matrix.artifact }}")
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
if-no-files-found: ignore
path: |
${{ matrix.artifact }}.tar.gz
${{ matrix.artifact }}.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.zip