Skip to content

Commit 7c8cf14

Browse files
committed
consolidate release pipeline
1 parent a862681 commit 7c8cf14

3 files changed

Lines changed: 40 additions & 49 deletions

File tree

.github/workflows/ci.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
types: [ published ]
1414
workflow_dispatch:
1515

16+
permissions:
17+
pull-requests: write
18+
contents: write
19+
1620
defaults:
1721
run:
1822
shell: bash
@@ -68,9 +72,43 @@ jobs:
6872
# This job checks if any of the previous jobs failed or were canceled.
6973
# This approach also allows some jobs to be skipped if they are not needed.
7074
ci-passed:
71-
if: always()
7275
needs: [ test, test-msrv ]
76+
if: always()
7377
runs-on: ubuntu-latest
7478
steps:
7579
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
7680
run: exit 1
81+
82+
# Release unpublished packages or create a PR with changes
83+
release-plz:
84+
needs: [ ci-passed ]
85+
if: |
86+
always()
87+
&& needs.ci-passed.result == 'success'
88+
&& github.event_name == 'push'
89+
&& github.ref == 'refs/heads/main'
90+
&& github.repository_owner == 'georust'
91+
runs-on: ubuntu-latest
92+
permissions:
93+
contents: write
94+
pull-requests: write
95+
concurrency:
96+
group: release-plz-${{ github.ref }}
97+
cancel-in-progress: false
98+
steps:
99+
- uses: actions/checkout@v4
100+
with: { fetch-depth: 0 }
101+
- uses: dtolnay/rust-toolchain@stable
102+
- name: Publish to crates.io if crate's version is newer
103+
uses: release-plz/action@v0.5
104+
id: release
105+
with: { command: release }
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
108+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
109+
- name: If version is the same, create a PR proposing new version and changelog for the next release
110+
uses: release-plz/action@v0.5
111+
if: ${{ steps.release.outputs.releases_created == 'false' }}
112+
with: { command: release-pr }
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}

.github/workflows/release-plz.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

release-plz.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[workspace]
2+
dependencies_update = true
23
git_release_name = "v{{ version }}"
34
git_tag_name = "v{{ version }}"

0 commit comments

Comments
 (0)