Skip to content

Commit 23be4f4

Browse files
penalosalrapoport-cfCarmenPopoviciu
authored
Hotfix action (#8192)
* Hotfix action * Update CONTRIBUTING.md * Apply suggestions from code review Co-authored-by: lrapoport-cf <[email protected]> * format * Update CONTRIBUTING.md Co-authored-by: Carmen Popoviciu <[email protected]> * Update .github/workflows/hotfix-release.yml Co-authored-by: Carmen Popoviciu <[email protected]> * Update CONTRIBUTING.md * fix formatting --------- Co-authored-by: lrapoport-cf <[email protected]> Co-authored-by: Carmen Popoviciu <[email protected]>
1 parent 59cb914 commit 23be4f4

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release a hotfix
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr-number:
6+
description: "Which PR should be released?"
7+
required: true
8+
confirm:
9+
description: "Confirm that the PR is up to date with the last published release, with the specific additional changes that should be released as part of this hotfix and the relevant package patch versions bumped"
10+
type: boolean
11+
required: true
12+
prerelease:
13+
description: "Publish to the hotfix tag on NPM for testing?"
14+
type: boolean
15+
required: true
16+
jobs:
17+
hotfix-release:
18+
name: Create Draft PR
19+
if: ${{ inputs.confirm == true }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout Repo
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Check user for team affiliation
28+
uses: tspascoal/get-user-teams-membership@v2
29+
id: teamAffiliation
30+
with:
31+
GITHUB_TOKEN: ${{ secrets.READ_ONLY_ORG_GITHUB_TOKEN }}
32+
username: ${{ github.actor }}
33+
team: wrangler
34+
35+
- name: Stop workflow if user is not a wrangler team member
36+
if: ${{ steps.teamAffiliation.outputs.isTeamMember == false }}
37+
run: |
38+
echo "You must be on the "wrangler" team to trigger this job."
39+
exit 1
40+
41+
- name: "Checkout PR"
42+
run: gh pr checkout ${{ inputs.pr-number }}
43+
env:
44+
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
45+
46+
- name: Install Dependencies
47+
uses: ./.github/actions/install-dependencies
48+
with:
49+
turbo-api: ${{ secrets.TURBO_API }}
50+
turbo-team: ${{ secrets.TURBO_TEAM }}
51+
turbo-token: ${{ secrets.TURBO_TOKEN }}
52+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
53+
54+
- name: Build all packages
55+
run: pnpm run build
56+
env:
57+
CI_OS: ${{ runner.os }}
58+
59+
- name: Publish packages (prerelease)
60+
if: ${{ inputs.prerelease == true }}
61+
run: pnpm publish -r --tag hotfix --filter wrangler --filter miniflare --filter create-cloudflare --dry-run
62+
63+
- name: Publish packages
64+
if: ${{ inputs.prerelease == false }}
65+
run: pnpm publish -r --filter wrangler --filter miniflare --filter create-cloudflare --dry-run

.github/workflows/run-ci-for-external-forks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Stop workflow if user is not a team member
3535
if: ${{ steps.teamAffiliation.outputs.isTeamMember == false }}
3636
run: |
37-
echo "You have must be on the "wrangler" team to trigger this job."
37+
echo "You must be on the "wrangler" team to trigger this job."
3838
exit 1
3939
4040
- name: "Checkout PR"

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,21 @@ When contributing to Wrangler, please refer to the [`STYLEGUIDE.md file`](STYLEG
431431
## Releases
432432

433433
We generally cut Wrangler releases on Tuesday & Thursday each week. If you need a release cut outside of the regular cadence, please reach out to the [@cloudflare/wrangler-admins](https://github.com/orgs/cloudflare/teams/wrangler-admins) team.
434+
435+
### Hotfix releases
436+
437+
Only members of `@cloudflare/wrangler` can trigger a hotfix release. A hotfix release should be treated as a solution of last resort—before use, please first check whether the fix can be applied and released using the regular Version Packages release flow.
438+
439+
If a hotfix release of Wrangler, Miniflare, or C3 is required, you should:
440+
441+
- Prepare a hotfix release PR:
442+
443+
- Checkout the previous release of `workers-sdk`
444+
- Apply the changes that should be in the hotfix
445+
- Increment the patch version of the packages that should be released as part of the hotfix
446+
447+
- Get approvals for that PR, and make sure CI checks are passing
448+
- Manually trigger a hotfix release from that PR using the ["Release a hotfix"](https://github.com/cloudflare/workers-sdk/actions/workflows/hotfix-release.yml) GitHub action.
449+
- Optionally, you can first publish it to the `hotfix` tag on NPM in order to verify the release.
450+
- **[CRUCIAL]** Once the hotfix release is out and verified, merge the fixes into main before the next regular release of `workers-sdk`.
451+
- Make sure that the version number of the next changesets-based release of Wrangler/Miniflare/C3 is greater than the version used for the hotfix by adding a dummy `minor` changeset entry for each of the packages that had a hotfix published.

0 commit comments

Comments
 (0)