Skip to content

Commit

Permalink
fix: release-plz release only runs on "chore: release" PRs (#1185)
Browse files Browse the repository at this point in the history
I also updated to use the new release-pr command to generate PRs in a
race-free way.
  • Loading branch information
danking authored Nov 1, 2024
1 parent 8adcd19 commit ba09095
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,56 @@ on:
- develop

jobs:
release-plz:
name: Release-plz

# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, "chore: release")
outputs:
releases_created: ${{ steps.run-release-plz.outputs.releases_created }} # Expose this step output as a job output
steps:
- uses: actions/checkout@v4
with:
# Needed to pull full commit history for release version number inference
fetch-depth: 0

- uses: ./.github/actions/cleanup

- uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/setup-uv@0.2.0

- name: Run release-plz
id: run-release-plz
uses: MarcoIeni/release-plz-action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
# Needed to pull full commit history for release version number inference
fetch-depth: 0
- uses: ./.github/actions/cleanup
- uses: ./.github/actions/setup-rust
- uses: spiraldb/actions/.github/actions/setup-uv@0.2.0
- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
macos:
needs: release-plz
if: ${{ needs.release-plz.outputs.releases_created == 'true' }}
needs: release-plz-release
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -82,8 +107,8 @@ jobs:
name: osx-wheels
path: target/wheels
linux:
needs: release-plz
if: ${{ needs.release-plz.outputs.releases_created == 'true' }}
needs: release-plz-release
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -121,8 +146,8 @@ jobs:
name: linux-wheels
path: target/wheels
release:
needs: [ release-plz, macos, linux ]
if: ${{ needs.release-plz.outputs.releases_created == 'true' }}
needs: [ release-plz-release, macos, linux ]
if: ${{ needs.release-plz-release.outputs.releases_created == 'true' }}
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
Expand Down

0 comments on commit ba09095

Please sign in to comment.