name: Release CI
on:
workflow_dispatch:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 2G
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v6
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- uses: mozilla-actions/sccache-action@v0.0.9
- run: sccache --show-stats || true
- name: Extract latest changelog
id: changelog
run: |
awk '/^### v/ { if (found) exit; found=1 } found' CHANGELOG.md > latest.md
echo "notes<<EOF" >> $GITHUB_OUTPUT
cat latest.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Publish to crates.io
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: cargo publish --token $CRATES_TOKEN --allow-dirty
- name: Create release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.notes }}