-
Notifications
You must be signed in to change notification settings - Fork 125
ci: two-stage release with manual approval #814
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
+186
−24
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0bbd10a
ci: two-stage release with manual approval
fengmk2 390ac32
ci: address review comments
fengmk2 87015a9
ci: address CodeRabbit review comments
fengmk2 4d9aded
ci: base prepare-release checkout on master
fengmk2 5519557
ci: make release version check robust against stale runs and prereleases
fengmk2 cb9c580
ci: fix sed portability, prerelease dist-tag, and npm view error hand…
fengmk2 ac67aaf
ci: simplify release workflow shell
fengmk2 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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,61 @@ | ||
| name: Prepare Release | ||
|
|
||
| permissions: {} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to release (without v prefix, e.g. 4.9.1 or 4.10.0-beta.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref_name }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| prepare: | ||
| if: github.repository == 'node-modules/urllib' | ||
| name: Prepare Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 | ||
| with: | ||
| # Always base the release branch on master, regardless of the ref the | ||
| # workflow was dispatched from. | ||
| ref: master | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Validate and bump version | ||
| env: | ||
| VERSION: ${{ inputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Require semver without a leading "v", e.g. 4.9.1 or 4.10.0-beta.0 | ||
| if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$'; then | ||
| echo "::error::Invalid version '$VERSION'. Expected semver without 'v' prefix, e.g. 4.9.1 or 4.10.0-beta.0" | ||
| exit 1 | ||
| fi | ||
| sed -i -E "s/^([[:space:]]*\"version\":[[:space:]]*)\"[^\"]+\"/\1\"$VERSION\"/" package.json | ||
| grep -qF "\"version\": \"$VERSION\"" package.json || { echo "::error::Failed to update package.json"; exit 1; } | ||
| echo "Updated package.json to $VERSION" | ||
|
|
||
| - name: Create pull request | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
| commit-message: 'release: v${{ inputs.version }}' | ||
| title: 'release: v${{ inputs.version }}' | ||
| branch: release/v${{ inputs.version }} | ||
| base: master | ||
| body: | | ||
| Release urllib v${{ inputs.version }}. | ||
|
|
||
| Merging this PR updates the version on `master` and triggers the release | ||
| workflow, which publishes to npm and creates the GitHub Release after | ||
| manual approval. | ||
| assignees: fengmk2 |
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.
Uh oh!
There was an error while loading. Please reload this page.