Skip to content

Commit 201e78f

Browse files
committed
add friendly logging to release script
1 parent ef64ebf commit 201e78f

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

scripts/release.sh

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ ctrl_c() {
1717
exit 1
1818
}
1919

20+
log() {
21+
echo "[RELEASE] $1"
22+
}
23+
2024
checkDir() {
25+
log "verifying CWD is monorepo root"
2126
if [[ -f ./package.json ]]; then
2227
if grep '"@patternfly/patternfly-elements"' package.json >/dev/null; then
28+
log "CWD is monorepo root"
2329
return
2430
fi
2531
fi
@@ -29,78 +35,90 @@ checkDir() {
2935
}
3036

3137
cleanWorkspace() {
38+
log "verifying clean workspace"
3239
git status --untracked-files=no --porcelain > /dev/null || exit 1
3340
}
3441

3542
checkoutMaster() {
43+
log "checkout master branch & pull"
3644
git checkout master || exit 1
3745
git pull origin master || exit 1
3846
}
3947

4048
bumpVersion() {
49+
log "bumping version"
4150
OLD_VERSION=$(node -e "console.log(require('./lerna.json').version)")
4251
./node_modules/.bin/lerna version --no-git-tag-version --no-push --preid="$PRERELEASE_PREFIX" || exit 1
4352
NEW_VERSION=$(node -e "console.log(require('./lerna.json').version)")
4453
}
4554

4655
createBranch() {
56+
log "creating release branch with new version numbers"
4757
TAG_NAME="v$NEW_VERSION"
4858
RELEASE_BRANCH="release/$TAG_NAME"
4959
git co -b $RELEASE_BRANCH || exit 1
5060
}
5161

5262
npmInstall() {
63+
log "installing NPM dependencies"
5364
npm ci || exit 1
5465
}
5566

5667
commitIgnoredFiles() {
68+
log "committing compiled bundles to release branch"
5769
git add elements/*/*.{js,map,css} -f || exit 1
5870
git commit -am "v$NEW_VERSION" || exit 1
5971
}
6072

6173
gitTag() {
74+
log "creating a git tag"
6275
git tag $TAG_NAME || exit 1
6376
}
6477

6578
removeIgnoredFiles() {
79+
log "removing the compiled bundles from release branch (they should only exist in the tag)"
6680
for e in elements/*; do find $e -maxdepth 1 \( -not -name "gulpfile.js" -not -name "rollup.config.js" \) \( -name "*.js" -or -name "*.css" -or -name "*.map" \) -exec git rm -f {} \; ;done
6781
git commit -am "remove bundles from $NEW_VERSION" || exit 1
6882
}
6983

7084
pushToOrigin() {
85+
log "pushing release branch to origin"
7186
git push origin $RELEASE_BRANCH -u || exit 1
87+
log "pushing tags to origin"
7288
git push --tags || exit 1
7389
}
7490

7591
resetMaster() {
92+
log "resetting master branch to origin/master"
7693
git checkout master || exit 1
7794
git reset --hard origin/master || exit 1
7895
}
7996

8097
npmPublish() {
98+
log "publishing newly versioned elements to NPM"
8199
git checkout $TAG_NAME || exit 1
82100
npm run lerna publish from-git || exit 1
83101
git checkout .
84102
}
85103

86104
handlePR() {
87105
if command -v hub > /dev/null; then
88-
echo "Hub installation found, creating a PR."
106+
log "Hub installation found, creating a PR."
89107
git checkout $RELEASE_BRANCH
90108
hub pull-request --browse --message "version bumps from release $RELEASE_BRANCH"
91109
else
92-
echo
93-
echo "FINAL STEP:"
94-
echo "Follow this link to create a pull request, merging the release branch ($RELEASE_BRANCH) into master."
95-
echo
96-
echo " https://github.com/patternfly/patternfly-elements/compare/$RELEASE_BRANCH?expand=1"
97-
echo
98-
echo "Note, if you install Hub (https://hub.github.com/) then this step will be automated in the future."
110+
log
111+
log "FINAL STEP:"
112+
log "Follow this link to create a pull request, merging the release branch ($RELEASE_BRANCH) into master."
113+
log
114+
log " https://github.com/patternfly/patternfly-elements/compare/$RELEASE_BRANCH?expand=1"
115+
log
116+
log "Note, if you install Hub (https://hub.github.com/) then this step will be automated in the future."
99117
fi
100118
}
101119

102120
goodbye() {
103-
echo "Returning you to the master branch."
121+
log "Returning you to the master branch."
104122
git checkout master
105123
}
106124

0 commit comments

Comments
 (0)