name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build-artifacts:
permissions:
contents: write
uses: ./.github/workflows/build-artifacts.yml
verify:
needs: ['build-artifacts']
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 50
- name: Fetch tags
run: git fetch --tags --force
- name: Cargo publish dry-run
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --dry-run
cargo-publish:
needs: ['build-artifacts', 'verify']
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 50
- name: Fetch tags
run: git fetch --tags --force
- name: Cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish
create-github-release:
needs: ['build-artifacts', 'verify']
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout .recent-changelog-entry
uses: actions/checkout@v6
with:
sparse-checkout: .recent-changelog-entry
sparse-checkout-cone-mode: false
- name: Download all workflow run artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
- name: Create Github release
working-directory: artifacts
run: |
gh release create "$GITHUB_REF_NAME" -F ../.recent-changelog-entry
ls | xargs -I{} zip -r {}.zip {}
ls *.zip | xargs gh release upload "$GITHUB_REF_NAME"