From e1e0b52ad758d9798bea5633555d3947f16b2076 Mon Sep 17 00:00:00 2001 From: Ute Weiss Date: Fri, 4 Aug 2023 14:46:58 +0200 Subject: [PATCH] chore: move the release tag to the commit that actually gets published Signed-off-by: Ute Weiss --- prepare_release.sh | 11 ++++------- release.sh | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/prepare_release.sh b/prepare_release.sh index 5b01f8be..f451efa2 100755 --- a/prepare_release.sh +++ b/prepare_release.sh @@ -67,23 +67,20 @@ npm run lint npm run build npm run test -echo "Committing version change and creating tag" +echo "Committing version change" git add package.json package-lock.json git commit -sm "chore: update version to $VERSION" -git tag -am "$VERSION_PREFIXED" "$VERSION_PREFIXED" if [[ $DRY_RUN = 1 ]]; then - echo "Pushing version and tag to GitHub repository (dry-run)" + echo "Pushing version to GitHub repository (dry-run)" git push --set-upstream "$UPSTREAM_URL" "$RELEASE_BRANCH" --dry-run - git push "$UPSTREAM_URL" "$VERSION_PREFIXED" --dry-run else - echo "Pushing version and tag to GitHub repository" + echo "Pushing version to GitHub repository" git push --set-upstream "$UPSTREAM_URL" "$RELEASE_BRANCH" - git push "$UPSTREAM_URL" "$VERSION_PREFIXED" fi echo "Please merge $RELEASE_BRANCH into $UPSTREAM_BRANCH" if [[ $DRY_RUN = 1 ]]; then - echo "Run these commands to clean up: git checkout $UPSTREAM_BRANCH && git branch -D $RELEASE_BRANCH && git tag -d $VERSION_PREFIXED" + echo "Run these commands to clean up: git checkout $UPSTREAM_BRANCH && git branch -D $RELEASE_BRANCH" fi diff --git a/release.sh b/release.sh index d6592baf..bfc818c2 100755 --- a/release.sh +++ b/release.sh @@ -64,6 +64,17 @@ npm run lint npm run build npm run test +echo "Creating release tag" +git tag -am "$VERSION_PREFIXED" "$VERSION_PREFIXED" + +if [[ $DRY_RUN = 1 ]]; then + echo "Pushing tag to GitHub repository (dry-run)" + git push "$UPSTREAM_URL" "$VERSION_PREFIXED" --dry-run +else + echo "Pushing tag to GitHub repository" + git push "$UPSTREAM_URL" "$VERSION_PREFIXED" +fi + if [[ $DRY_RUN = 1 ]]; then echo "Publish to npmjs (dry-run)" npm publish --access public --registry https://registry.npmjs.org/ --dry-run @@ -71,3 +82,7 @@ else echo "Publish to npmjs" npm publish --access public --registry https://registry.npmjs.org/ fi + +if [[ $DRY_RUN = 1 ]]; then + echo "Run this command to clean up: git tag -d $VERSION_PREFIXED" +fi \ No newline at end of file