Skip to content

Commit b71bf89

Browse files
authored
chore(releases): minor improvements to the release workflow (#2764)
Changes in this PR: - Arbitrary refs are now allowed when triggering the release workflow manually (ref must be on the main branch). - Release summary is now displayed in the GH job output; makes for a nicer experience when approving the release workflow.
1 parent 28c0c78 commit b71bf89

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ on:
1515
- release
1616
- prerelease
1717
default: "prerelease"
18-
prerelease_ref:
19-
description: "The ref (branch, tag, or SHA) to checkout and release from (prerelease only)"
20-
required: false
18+
ref:
19+
description: "The ref (branch, tag, or SHA) to checkout and release from"
20+
required: true
2121
type: string
2222
prerelease_tag:
2323
description: "The npm dist-tag for the prerelease (e.g., 'v4-prerelease')"
@@ -30,6 +30,21 @@ concurrency:
3030
cancel-in-progress: false
3131

3232
jobs:
33+
show-release-summary:
34+
name: 📋 Release Summary
35+
runs-on: ubuntu-latest
36+
if: |
37+
github.repository == 'triggerdotdev/trigger.dev' &&
38+
github.event_name == 'pull_request' &&
39+
github.event.pull_request.merged == true &&
40+
github.event.pull_request.head.ref == 'changeset-release/main'
41+
steps:
42+
- name: Show release summary
43+
env:
44+
PR_BODY: ${{ github.event.pull_request.body }}
45+
run: |
46+
echo "$PR_BODY" | sed -n '/^# Releases/,$p' >> $GITHUB_STEP_SUMMARY
47+
3348
release:
3449
name: 🚀 Release npm packages
3550
runs-on: ubuntu-latest
@@ -53,7 +68,15 @@ jobs:
5368
uses: actions/checkout@v4
5469
with:
5570
fetch-depth: 0
56-
ref: main
71+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.sha }}
72+
73+
- name: Verify ref is on main
74+
if: github.event_name == 'workflow_dispatch'
75+
run: |
76+
if ! git merge-base --is-ancestor ${{ github.event.inputs.ref }} origin/main; then
77+
echo "Error: ref must be an ancestor of main (i.e., already merged)"
78+
exit 1
79+
fi
5780
5881
- name: Setup pnpm
5982
uses: pnpm/action-setup@v4
@@ -121,14 +144,7 @@ jobs:
121144
uses: actions/checkout@v4
122145
with:
123146
fetch-depth: 0
124-
ref: ${{ github.event.inputs.prerelease_ref }}
125-
126-
- name: Validate ref is on main
127-
run: |
128-
if ! git merge-base --is-ancestor ${{ github.event.inputs.prerelease_ref }} origin/main; then
129-
echo "Error: ref must be an ancestor of main (i.e., already merged)"
130-
exit 1
131-
fi
147+
ref: ${{ github.event.inputs.ref }}
132148

133149
- name: Setup pnpm
134150
uses: pnpm/action-setup@v4

0 commit comments

Comments
 (0)