-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the release PR workflow & add a release-it workflow, too
Now the workflow for releasing this crate is: 1. Trigger the "Create release PR" workflow with the right version, 2. fix up anything in the release PR (e.g. changelog) 3. squash&merge that PR 4. Another workflow triggers that will tag the release & publish to crates.io at the version just released.
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Cut a new release | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
tag_github_release: | ||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') | ||
|
||
permissions: | ||
id-token: write # Enable OIDC | ||
contents: write | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo merge commit is $GITHUB_SHA, from PR branch ${{ github.event.pull_request.head.ref }} | ||
- uses: actions-ecosystem/action-regex-match@v2 | ||
id: version | ||
with: | ||
text: ${{ github.event.pull_request.head.ref }} | ||
regex: "^release/([^/]+)/(.+)$" | ||
# Name of crate is steps.version.outputs.group1, version is steps.version.outputs.group2. | ||
# TODO: figure out how this works with workspaces & multiple crates | ||
|
||
- name: Create release v${{steps.version.outputs.group2}} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: v${{ steps.version.outputs.group2 }} | ||
name: ${{steps.version.outputs.group1}} v${{ steps.version.outputs.group2 }} | ||
target_commitish: ${{github.sha}} | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
|
||
- run: cargo publish --token ${CRATES_TOKEN} | ||
env: | ||
CRATES_TOKEN: ${{ secrets.CRATESIO_RELEASE_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters