22
33# Find the commit on master that last changed the root package.json version,
44# then submit a PR to merge that commit onto the release branch and release via nucleus
5+ # Optionally set WORK_ITEM env var to include in commit/PR title
56# Usage: yarn release:publish [branch=release]
7+ # Example: WORK_ITEM=W-1234567 yarn release:publish
68
79set -e
810
@@ -28,35 +30,41 @@ VERSION=$(jq -r .version package.json)
2830git switch -c " $BRANCH " " $VERSION_SHA "
2931git push origin HEAD
3032
31- if which gh > /dev/null; then
32- # Use GitHub CLI to create a PR and wait for CI checks to pass
33- gh pr create -t " chore: release $VERSION " -B " $RELEASE_BRANCH " -b ' '
34- # Clean up locally
35- git switch " $BASE_BRANCH "
36- git branch -D " $BRANCH "
37-
38- # Wait for CI to complete
39- . " $( dirname " $0 " ) /wait-for-pr.sh" " $BRANCH "
40- if ! gh pr checks --fail-fast --watch; then
41- echo ' CI failed. Cannot continue with release.'
42- gh pr view " $BRANCH " --web
43- exit 1
44- fi
45-
46- sleep 10 # Give nucleus time to start the release job
47- RELEASE_JOB=$( gh pr checks " $BRANCH " --json name,link -q ' .[]|select(.name=="continuous-integration/nucleus/release").link' )
48- echo " Nucleus release started: $RELEASE_JOB "
49-
50- # Wait for GitHub release to be created by Nucleus, then open it
51- echo ' The GitHub release notes must be added manually. You can exit the script now and open GitHub on your own, or wait until the release is created and the script will open the page for you.'
52- sleep 300 # Nucleus job usually takes ~5 minutes
53- while ! gh release view " v$VERSION " 1> /dev/null 2> /dev/null; do
54- sleep 15
55- done
56- gh release view " v$VERSION " --web
57- else
33+ if ! which gh > /dev/null; then
5834 # GitHub CLI not installed - clean up and prompt for manual branch creation
5935 git switch " $BASE_BRANCH "
6036 git branch -D " $BRANCH "
6137 echo " Open a PR: https://github.com/salesforce/lwc/pull/new/$BRANCH "
38+ exit 0
6239fi
40+
41+ PR_TITLE=" chore: release $VERSION "
42+ if [ -n " $WORK_ITEM " ]; then
43+ PR_TITLE+=" @$WORK_ITEM "
44+ fi
45+ # Use GitHub CLI to create a PR and wait for CI checks to pass
46+ gh pr create -t " $PR_TITLE " -b ' ' -B " $RELEASE_BRANCH " -H " $BRANCH "
47+ # Clean up locally
48+ git switch " $BASE_BRANCH "
49+ git branch -D " $BRANCH "
50+
51+ # Wait for CI to complete
52+ sleep 3 # Give GitHub time to kick off CI
53+ . " $( dirname " $0 " ) /wait-for-pr.sh" " $BRANCH "
54+ if ! gh pr checks --fail-fast --watch; then
55+ echo ' CI failed. Cannot continue with release.'
56+ gh pr view " $BRANCH " --web
57+ exit 1
58+ fi
59+
60+ sleep 10 # Give nucleus time to start the release job
61+ RELEASE_JOB=$( gh pr checks " $BRANCH " --json name,link -q ' .[]|select(.name=="continuous-integration/nucleus/release").link' )
62+ echo " Nucleus release started: $RELEASE_JOB "
63+
64+ # Wait for GitHub release to be created by Nucleus, then open it
65+ echo ' The GitHub release notes must be added manually. You can exit the script now and open GitHub on your own, or wait until the release is created and the script will open the page for you.'
66+ sleep 300 # Nucleus job usually takes ~5 minutes
67+ while ! gh release view " v$VERSION " > /dev/null; do
68+ sleep 15
69+ done
70+ gh release view " v$VERSION " --web
0 commit comments