Skip to content

Commit cc704fb

Browse files
authored
Merge pull request #6 from MetaMask/fix/checkout-new-branch-before-commit
fix: checkout new branch before commit
2 parents 323c0ae + c2d09e9 commit cc704fb

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

run.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
set -u
6+
17
export NEW_VERSION="${1}"
8+
export BRANCH_NAME="release-v${NEW_VERSION}"
29
export GITHUB_ACTION_PATH="${2}"
310
export RELEASE_BODY="$(awk -v version="${NEW_VERSION}" -f ${GITHUB_ACTION_PATH}/scripts/show-changelog.awk CHANGELOG.md)"
411

5-
node "${GITHUB_ACTION_PATH}/scripts/update-package-version.js"
6-
712
git config user.name github-actions
813
git config user.email [email protected]
914

10-
if ! (git add . && git commit -m "Release ${NEW_VERSION}" && git push);
15+
node "${GITHUB_ACTION_PATH}/scripts/update-package-version.js"
16+
17+
git checkout -b "${BRANCH_NAME}"
18+
19+
if ! (git add . && git commit -m "${NEW_VERSION}" && git push);
1120
then
12-
echo "No changes"
21+
echo "Error: No changes detected."
22+
exit 1
1323
fi
1424

1525
hub pull-request \
1626
--draft \
1727
--message "${NEW_VERSION} RC" --message "${RELEASE_BODY}" \
1828
--base "main" \
19-
--head "${NEW_VERSION}";
29+
--head "${BRANCH_NAME}";

0 commit comments

Comments
 (0)