Skip to content

Commit 305fa53

Browse files
committed
chore(release): flip logic to flatten file
1 parent afab8bf commit 305fa53

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

scripts/release/publish.sh

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,41 @@ VERSION=$(jq -r .version package.json)
3030
git switch -c "$BRANCH" "$VERSION_SHA"
3131
git push origin HEAD
3232

33-
if which gh >/dev/null; then
34-
PR_TITLE="chore: release $VERSION"
35-
if [ -n "$WORK_ITEM" ]; then
36-
PR_TITLE+=" @$WORK_ITEM"
37-
fi
38-
# Use GitHub CLI to create a PR and wait for CI checks to pass
39-
gh pr create -t "$PR_TITLE" -b '' -B "$RELEASE_BRANCH" -H "$BRANCH"
40-
# Clean up locally
41-
git switch "$BASE_BRANCH"
42-
git branch -D "$BRANCH"
43-
44-
# Wait for CI to complete
45-
sleep 3 # Give GitHub time to kick off CI
46-
. "$(dirname "$0")/wait-for-pr.sh" "$BRANCH"
47-
if ! gh pr checks --fail-fast --watch; then
48-
echo 'CI failed. Cannot continue with release.'
49-
gh pr view "$BRANCH" --web
50-
exit 1
51-
fi
52-
53-
sleep 10 # Give nucleus time to start the release job
54-
RELEASE_JOB=$(gh pr checks "$BRANCH" --json name,link -q '.[]|select(.name=="continuous-integration/nucleus/release").link')
55-
echo "Nucleus release started: $RELEASE_JOB"
56-
57-
# Wait for GitHub release to be created by Nucleus, then open it
58-
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.'
59-
sleep 300 # Nucleus job usually takes ~5 minutes
60-
while ! gh release view "v$VERSION" 1>/dev/null 2>/dev/null; do
61-
sleep 15
62-
done
63-
gh release view "v$VERSION" --web
64-
else
33+
if ! which gh >/dev/null; then
6534
# GitHub CLI not installed - clean up and prompt for manual branch creation
6635
git switch "$BASE_BRANCH"
6736
git branch -D "$BRANCH"
6837
echo "Open a PR: https://github.com/salesforce/lwc/pull/new/$BRANCH"
38+
exit 0
39+
fi
40+
41+
PR_TITLE="chore: release $VERSION"
42+
if [ -n "$WORK_ITEM" ]; then
43+
PR_TITLE+=" @$WORK_ITEM"
6944
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" 1>/dev/null 2>/dev/null; do
68+
sleep 15
69+
done
70+
gh release view "v$VERSION" --web

0 commit comments

Comments
 (0)