Skip to content

Commit 145d7cb

Browse files
authored
chore(release): update scripts for other git configs and backports (#5454)
* chore(release): avoid unnecessarily checking out branch it can be created and pushed without checkout * chore(release): add flexibility for backport version bumps
1 parent 233b384 commit 145d7cb

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

scripts/release/publish.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ VERSION_SHA=$(git blame -- package.json | grep '"version":' | cut -d' ' -f1)
2727
VERSION=$(jq -r .version package.json)
2828

2929
# Create a new branch with the changes to release
30-
git switch -c "$BRANCH" "$VERSION_SHA"
31-
git push origin HEAD
30+
git branch "$BRANCH" "$VERSION_SHA"
31+
git push -u origin "$BRANCH"
32+
git branch -D "$BRANCH"
33+
3234

3335
if ! which gh >/dev/null; then
3436
# GitHub CLI not installed - clean up and prompt for manual branch creation
35-
git switch "$BASE_BRANCH"
36-
git branch -D "$BRANCH"
3737
echo "Open a PR: https://github.com/salesforce/lwc/pull/new/$BRANCH"
3838
exit 0
3939
fi
@@ -44,14 +44,11 @@ if [ -n "$WORK_ITEM" ]; then
4444
fi
4545
# Use GitHub CLI to create a PR and wait for CI checks to pass
4646
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"
5047

5148
# Wait for CI to complete
5249
sleep 3 # Give GitHub time to kick off CI
5350
. "$(dirname "$0")/wait-for-pr.sh" "$BRANCH"
54-
if ! gh pr checks --fail-fast --watch; then
51+
if ! gh pr checks "$BRANCH" --fail-fast --watch; then
5552
echo 'CI failed. Cannot continue with release.'
5653
gh pr view "$BRANCH" --web
5754
exit 1

scripts/release/version.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ if ! gh >/dev/null; then
4444
fi
4545

4646
# Use GitHub CLI to create a PR and wait for it to be merged before exiting
47-
gh pr create -t "$VERSION_BUMP_MESSAGE" -b ''
48-
gh pr merge --auto --squash --delete-branch
47+
gh pr create -t "$VERSION_BUMP_MESSAGE" -b '' -B "$BASE_BRANCH" -H "$BRANCH"
48+
# Squash on master, but not backports
49+
[ "$BASE_BRANCH" == 'master' ] && SQUASH='--squash'
50+
gh pr merge --auto --delete-branch $SQUASH
4951
git switch "$BASE_BRANCH"
5052
git branch -D "$BRANCH"
5153

0 commit comments

Comments
 (0)