name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with:
persist-credentials: false
- run: cargo clippy --all-targets --locked -- -D warnings
- run: cargo test --locked
codeql:
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with:
persist-credentials: false
- uses: github/codeql-action/init@b31ef66637df4fc5b5e4a89d0cc94f8eeb46a04d with:
languages: rust
- run: cargo build --locked
- uses: github/codeql-action/analyze@b31ef66637df4fc5b5e4a89d0cc94f8eeb46a04d
build:
needs: codeql
strategy:
matrix:
include:
- 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: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with:
persist-credentials: false
- run: rustup target add ${{ matrix.target }}
- run: cargo build --release --locked --bin probation --target ${{ matrix.target }}
- name: Package
run: |
set -euo pipefail
pkg="probation-${{ github.ref_name }}-${{ matrix.target }}"
mkdir "$pkg"
cp "target/${{ matrix.target }}/release/probation" README.md LICENSE "$pkg/"
tar czf "$pkg.tar.gz" "$pkg"
shasum -a 256 "$pkg.tar.gz" > "$pkg.tar.gz.sha256"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with:
name: probation-${{ matrix.target }}
path: |
probation-*.tar.gz
probation-*.tar.gz.sha256
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with:
pattern: probation-*
merge-multiple: true
- run: gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --generate-notes probation-*.tar.gz probation-*.tar.gz.sha256
env:
GH_TOKEN: ${{ github.token }}
publish:
needs: release
runs-on: ubuntu-latest
environment: crates-io
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with:
persist-credentials: false
- run: cargo package --locked
- run: cargo publish --locked --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}