name: release-plz
on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
release-plz-pr:
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 - uses: dtolnay/rust-toolchain@stable
- uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-plz-release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write actions: write steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Authenticate to crates.io (Trusted Publishing)
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: release-plz release
id: release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
- name: Dispatch cargo-dist
if: ${{ steps.release-plz.outputs.releases_created == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASES: ${{ steps.release-plz.outputs.releases }}
run: |
tag=$(echo "$RELEASES" | jq -r '.[0].tag')
if [ -n "$tag" ] && [ "$tag" != "null" ]; then
echo "Dispatching cargo-dist for $tag"
gh workflow run release.yml --ref main -f tag="$tag"
else
echo "No tag in release output; skipping cargo-dist"
fi