name: CD
on:
push:
tags:
- "v?[0-9]+.[0-9]+.[0-9]+"
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
permissions: {}
jobs:
build:
name: Build
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: true
matrix:
rust: [stable]
job:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-11-arm
target: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de with:
toolchain: ${{ matrix.rust }}
- uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 with:
key: ${{ matrix.job.target }}
- name: Install modern bash on macOS
if: startsWith(matrix.job.os, 'macos')
run: |
brew install bash
echo "/opt/homebrew/bin" >> "$GITHUB_PATH"
shell: bash
- name: Build
run: mise run cd:build --target "${{ matrix.job.target }}"
shell: bash
- name: Upload binaries as artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: artifact-${{ matrix.job.target }}
path: target/dist/*
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Download built artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with:
pattern: artifact-*
path: target/dist
merge-multiple: true
- name: Releasing assets
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 with:
files: target/dist/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cd-complete:
needs:
- build
- release
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: CD complete
run: |
if ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}; then
echo "CD succeeded"
else
echo "CD failed"
exit 1
fi
shell: bash