From 39b7a94c26cd8d0adba0044cca77cc6686696172 Mon Sep 17 00:00:00 2001 From: Forrest Baer Date: Thu, 11 Aug 2022 14:04:01 -0500 Subject: [PATCH] [No-ticket] release script revision to order tagging differently (#2041) * updating release script to do things in the right order * Publish - @cmsgov/design-system-docs@4.0.0 - @cmsgov/design-system-scripts@4.0.0 - @cmsgov/design-system@4.0.0 - @cmsgov/cms-design-system-docs@4.0.0 - @cmsgov/ds-healthcare-gov@8.0.0 - @cmsgov/ds-medicare-gov@6.0.0 * should be reverting as well * Revert "Publish" This reverts commit 8f06e5b8027487ee84a43b0461caab7d8ffe1ff9. --- scripts/release.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index c1ec1e677b..e57fdccce1 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -50,7 +50,7 @@ if [ "$DELETE_LAST" = true ]; then echo if [[ $REPLY =~ ^[Yy]$ ]] then - echo "${GREEN}Undoing last release...${NC}" + echo "${GREEN}Removing last set of tags...${NC}" git tag -d $TAGS git push origin --delete $TAGS echo "${GREEN}Tags deleted...${NC}" @@ -61,6 +61,7 @@ if [ "$DELETE_LAST" = true ]; then exit 0 fi +# bump current versions in active branch echo "${GREEN}Bumping package versions...${NC}" PRE_VERSION_HASH=$(git rev-parse HEAD) yarn lerna version --no-push --exact ${EXTRA_OPTS[@]} @@ -71,6 +72,7 @@ if [ "$PRE_VERSION_HASH" = "$POST_VERSION_HASH" ]; then exit 1 fi +# read tags and push to active branch echo "${GREEN}Pushing tags and version update commit to Github...${NC}" read_previous_commit_tags @@ -78,6 +80,18 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD) git push --set-upstream origin $BRANCH git push origin $TAGS +# create temporary release branch from latest commit which is tagged +# add an empty commit so it can be pushed to origin and PR'd then +# move back to previous branch so tags can be deleted with --undo +# if necessary. +echo "${GREEN}Creating temporary release branch...${NC}" +BRANCHREF=$(git rev-parse --short HEAD) +TEMP_BRANCH="release-${BRANCHREF}" +git checkout -b $TEMP_BRANCH +git commit --allow-empty -m "DS Release Bump" +git push --set-upstream origin $TEMP_BRANCH +git checkout $BRANCH + echo "" echo "${GREEN}Release has been tagged and pushed to origin.${NC}" echo "" @@ -87,7 +101,7 @@ echo "${YELLOW}-------${NC}" echo "" echo "${YELLOW}NEXT STEPS:${NC}" echo "" -echo "${YELLOW} 1. Create a pull request for merging \`${CYAN}$BRANCH${YELLOW}\` into master to save the version bump${NC}." +echo "${YELLOW} 1. Create a pull request for merging \`${CYAN}$TEMP_BRANCH${YELLOW}\` into master to save the version bump${NC}." echo "" echo "${YELLOW} 2. Publish this release using the \`${CYAN}publish${YELLOW}\` jenkins job${NC}." echo ""