name: release
on:
push:
branches:
- main
pull_request:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
release:
permissions:
id-token: write
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'release' || '' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - uses: raviqqe/cargo-cache@4c7db86c0f73cc94a5608ad8b09e7a8e136fd259 - run: cargo install cargo-workspaces
- uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 id: auth
if: github.ref == 'refs/heads/main'
- run: cargo workspaces publish -y --from-git ${{ github.ref != 'refs/heads/main' && '--dry-run' || '' }}
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}