Skip to content

Commit 02b441d

Browse files
committed
ci: support the 4.6 hotfix release branch
1 parent 2d03fee commit 02b441d

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

‎.github/workflows/changesets-pr.yml‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- "release/**"
78
paths:
89
- "packages/**"
910
- ".changeset/**"
@@ -57,11 +58,13 @@ jobs:
5758
env:
5859
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5960
run: |
60-
PR_NUMBER=$(gh pr list --head changeset-release/main --json number --jq '.[0].number')
61+
SOURCE_BRANCH="${GITHUB_REF_NAME}"
62+
PR_BRANCH="changeset-release/${SOURCE_BRANCH}"
63+
PR_NUMBER=$(gh pr list --head "$PR_BRANCH" --json number --jq '.[0].number')
6164
if [ -n "$PR_NUMBER" ]; then
62-
git fetch origin changeset-release/main
65+
git fetch origin "+${PR_BRANCH}:refs/remotes/origin/${PR_BRANCH}"
6366
# we arbitrarily reference the version of the cli package here; it is the same for all package releases
64-
VERSION=$(git show origin/changeset-release/main:packages/cli-v3/package.json | jq -r '.version')
67+
VERSION=$(git show "origin/${PR_BRANCH}:packages/cli-v3/package.json" | jq -r '.version')
6568
gh pr edit "$PR_NUMBER" --title "chore: release v$VERSION"
6669
6770
# Enhance the PR body with a clean, deduplicated summary
@@ -78,16 +81,18 @@ jobs:
7881
# design cannot trigger downstream workflows. That leaves the required
7982
# "All PR Checks" status permanently Expected and the PR unmergeable.
8083
# The release PR only bumps package.json + lockfile + CHANGELOGs from
81-
# changesets already on main, so we self-report the required check as
82-
# success. If a human ever pushes to changeset-release/main, the real
83-
# pr_checks.yml fires and its result overwrites this one (last write wins
84-
# for the same context on the same SHA).
84+
# changesets already on the source branch, so we self-report the required
85+
# check as success. If a human pushes to the generated release branch, the
86+
# real pr_checks.yml result overwrites this one (last write wins for the
87+
# same context on the same SHA).
8588
- name: Self-report "All PR Checks" success on release PR
8689
if: steps.changesets.outputs.published != 'true'
8790
env:
8891
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8992
run: |
90-
PR_NUMBER=$(gh pr list --head changeset-release/main --json number --jq '.[0].number')
93+
SOURCE_BRANCH="${GITHUB_REF_NAME}"
94+
PR_BRANCH="changeset-release/${SOURCE_BRANCH}"
95+
PR_NUMBER=$(gh pr list --head "$PR_BRANCH" --json number --jq '.[0].number')
9196
if [ -z "$PR_NUMBER" ]; then exit 0; fi
9297
HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid --jq '.headRefOid')
9398
gh api -X POST repos/${{ github.repository }}/check-runs \
@@ -96,4 +101,4 @@ jobs:
96101
-f status=completed \
97102
-f conclusion=success \
98103
-f 'output[title]=Auto-pass for changeset release PR' \
99-
-f 'output[summary]=Required check auto-satisfied for changeset-release/main PRs. Full CI ran on the underlying commits before they landed on main.'
104+
-f "output[summary]=Required check auto-satisfied for ${PR_BRANCH} PRs. Full CI ran on the underlying commits before they landed on ${SOURCE_BRANCH}."

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
types: [closed]
66
branches:
77
- main
8+
- "release/**"
89
workflow_dispatch:
910
inputs:
1011
type:
@@ -38,7 +39,7 @@ jobs:
3839
github.repository == 'triggerdotdev/trigger.dev' &&
3940
github.event_name == 'pull_request' &&
4041
github.event.pull_request.merged == true &&
41-
github.event.pull_request.head.ref == 'changeset-release/main'
42+
startsWith(github.event.pull_request.head.ref, 'changeset-release/')
4243
steps:
4344
- name: Show release summary
4445
env:
@@ -58,7 +59,7 @@ jobs:
5859
github.repository == 'triggerdotdev/trigger.dev' &&
5960
(
6061
(github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release') ||
61-
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'changeset-release/main')
62+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'changeset-release/'))
6263
)
6364
outputs:
6465
published: ${{ steps.changesets.outputs.published }}
@@ -166,7 +167,7 @@ jobs:
166167
gh release create "v${VERSION}" \
167168
--title "trigger.dev v${VERSION}" \
168169
--notes-file /tmp/release-body.md \
169-
--target main \
170+
--target "$(git rev-parse HEAD)" \
170171
$PRERELEASE_FLAG
171172
172173
- name: Create and push Docker tag

0 commit comments

Comments
 (0)