Skip to content

Commit

Permalink
chore: move the release tag to the commit that actually gets published
Browse files Browse the repository at this point in the history
Signed-off-by: Ute Weiss <[email protected]>
  • Loading branch information
weissu42 committed Aug 4, 2023
1 parent c0f3e69 commit e1e0b52
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
11 changes: 4 additions & 7 deletions prepare_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,25 @@ 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
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

0 comments on commit e1e0b52

Please sign in to comment.