diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97425766..d7e1b777 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,11 @@ name: CI +# Pushes to main run CI via release-plz.yml (as a reusable workflow), so +# releases can be gated on it without a `workflow_run` trigger. on: - push: - branches: - - main pull_request: workflow_dispatch: + workflow_call: concurrency: group: ci-${{ github.ref }} diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index 41f12e1a..2832c360 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -1,17 +1,23 @@ name: Release-plz -# Only release once CI has passed on main. +# Only release once CI has passed on main. CI is invoked as a reusable workflow +# rather than via `workflow_run`, because crates.io trusted publishing rejects +# OIDC tokens from `workflow_run`-triggered runs. on: - workflow_run: - workflows: [CI] - types: [completed] - branches: [main] + push: + branches: + - main jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + release-plz-release: name: Release-plz release runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'toolCHAINZ' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} + needs: ci + if: ${{ github.repository_owner == 'toolCHAINZ' }} permissions: contents: write id-token: write @@ -40,7 +46,8 @@ jobs: release-plz-pr: name: Release-plz PR runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'toolCHAINZ' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }} + needs: ci + if: ${{ github.repository_owner == 'toolCHAINZ' }} permissions: pull-requests: write contents: write