-
Notifications
You must be signed in to change notification settings - Fork 99
Ci/add release plz #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Ci/add release plz #335
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,116 @@ | ||
| name: Release-plz | ||
|
|
||
| # How this works (see https://release-plz.dev/docs/github/quickstart): | ||
| # | ||
| # This workflow is triggered manually only (Actions -> "Release-plz" -> "Run | ||
| # workflow"). Select the branch to release from in the "Use workflow from" | ||
| # dropdown (e.g. the default branch or `release/1.x`) and click "Run workflow". | ||
| # Both jobs below run on every dispatch: | ||
| # | ||
| # 1. The `release-pr` job opens/updates a release PR (branch prefix `release-plz-`) | ||
| # with the version bump and changelog for updated crates, targeting the | ||
| # selected branch, authored by the `bitcoindevkit-release-plz` GitHub App. | ||
| # The version bump for each crate is computed from that branch's Cargo.toml. | ||
| # Re-run it to refresh the release PR after new commits land on the branch. | ||
| # 2. The `release` job checks whether the release PR has been merged. If so, it | ||
| # publishes the crate to crates.io (via trusted publishing / OIDC, no token | ||
| # secret) and creates the `vX.Y.Z` git tag and GitHub release. | ||
| # The job runs in the `release` GitHub environment, whose required reviewers | ||
| # are defined in the GitHub repository config; publishing waits until an | ||
| # authorized GitHub user approves it in the Actions UI. | ||
| # | ||
| # Notes: | ||
| # - release-plz supports only one open release PR per repository, so don't | ||
| # prepare releases on two branches concurrently. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| # Create or update the PR with the new version and changelog. | ||
| release-pr: | ||
| name: Create/Update Rust Release PR | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.repository_owner == 'bitcoindevkit' }} | ||
| permissions: | ||
| contents: write # push the release PR branch | ||
| pull-requests: write # open and update the release PR | ||
| concurrency: | ||
| group: release-plz-${{ github.ref_name }} | ||
| cancel-in-progress: false | ||
| steps: | ||
| - name: Validate selected branch | ||
| env: | ||
| BRANCH: ${{ github.ref_name }} | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| run: | | ||
| case "$BRANCH" in | ||
| "$DEFAULT_BRANCH"|release/*) ;; | ||
| *) echo "Refusing to release from '$BRANCH' (expected '$DEFAULT_BRANCH' or 'release/*')"; exit 1 ;; | ||
| esac | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| app-id: ${{ secrets.RELEASE_PLZ_APP_ID }} | ||
| private-key: ${{ secrets.RELEASE_PLZ_PRIVATE_KEY }} | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v2 | ||
| - name: Run release-plz | ||
| uses: release-plz/action@v0.5 | ||
| with: | ||
| command: release-pr | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| # If the release PR was merged, publish to crates.io, tag, and create the | ||
| # GitHub release. Gated by the `release` environment (team approval). | ||
| release: | ||
| name: Publish Rust Release | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.repository_owner == 'bitcoindevkit' }} | ||
| environment: release | ||
| permissions: | ||
| contents: write # push tags and create GitHub releases | ||
| pull-requests: read # detect the merged release PR | ||
| id-token: write # crates.io trusted publishing (OIDC) | ||
| steps: | ||
| - name: Validate selected branch | ||
| env: | ||
| BRANCH: ${{ github.ref_name }} | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| run: | | ||
| case "$BRANCH" in | ||
| "$DEFAULT_BRANCH"|release/*) ;; | ||
| *) echo "Refusing to release from '$BRANCH' (expected '$DEFAULT_BRANCH' or 'release/*')"; exit 1 ;; | ||
| esac | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| app-id: ${{ secrets.RELEASE_PLZ_APP_ID }} | ||
| private-key: ${{ secrets.RELEASE_PLZ_PRIVATE_KEY }} | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.ref_name }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v2 | ||
| - name: Run release-plz | ||
| uses: release-plz/action@v0.5 | ||
| with: | ||
| command: release | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| # No CARGO_REGISTRY_TOKEN on purpose: crates.io trusted publishing is | ||
| # configured for this repo + workflow + the `release` environment. |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the release templates will no longer be used, do we update them to contain the steps in triggering the workflow or we will delete them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've removed the minor_release.md template since we don't need it. We should still create a summary for posting about releases on social media, but that can be done ad-hoc for now. I've found trying to use one summary everywhere didn't really work anyway.