name: Create release
on:
push:
tags:
- "*"
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
container: rust
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Publish
run: |
cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
generate-changelog:
name: Generate changelog
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}
- name: Upload changelog artifact
uses: actions/upload-artifact@v4
with:
name: changelog
path: CHANGES.md
create-release:
needs:
- generate-changelog
name: Create the release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download changelog artifact
uses: actions/download-artifact@v4
with:
name: changelog
- name: Create the release
run: |
gh release create --draft --title "Release ${{ github.ref_name }}" --notes-file CHANGES.md ${{ github.ref_name }}
env:
GH_TOKEN: ${{ github.token }}