name: Release
run-name: release ${{ github.ref_name }}
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy --all-features -- -D warnings
- run: cargo test --all-features
- run: cargo publish --all-features
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- uses: orhun/git-cliff-action@v4
id: changelog
with:
args: --latest
- name: Generate release notes
run: echo "${{ steps.changelog.outputs.content }}" | tail -n +2 > RELEASE_NOTES.md
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body_path: RELEASE_NOTES.md