From 76051a6ac2fb60dbc79d3fde8405169b4c3a41bf Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Sun, 22 Jan 2017 00:39:15 +0100 Subject: [PATCH 1/2] Fix release script after experience from 0.7.1 release * Also edit dist/README.md. Otherwise npm publish will overwrite that AFTER the dist directory has been added, causing the git checkout to fail. And it's the right thing to do anyway, having ALL the READMEs edited. * Add all the modified READMEs so they get committed correctly. * Improve two references to master which are no longer accurate. * Check for uncommitted changes just before creating the tag. * Encourage always specifying the next version, as discussed in https://github.com/Khan/KaTeX/pull/615#discussion_r97208770 --- release.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/release.sh b/release.sh index 809a6a8f..a5a0475b 100755 --- a/release.sh +++ b/release.sh @@ -24,9 +24,12 @@ usage() { echo "" echo "Examples:" echo " When releasing a new point release:" - echo " ./release.sh 0.6.3" + echo " ./release.sh 0.6.3 0.6.4" echo " When releasing a new major version:" echo " ./release.sh 0.7.0 0.8.0" + echo "" + echo "You may omit NEXT_VERSION in order to avoid creating a commit on" + echo "the branch from which the release was created. Not recommended." exit $1 } @@ -114,11 +117,12 @@ rm -f package.json.bak # Update the version number in CDN URLs included in the README files, # and regenerate the Subresource Integrity hash for these files. -node update-sri.js "${VERSION}" README.md contrib/*/README.md +node update-sri.js "${VERSION}" README.md contrib/*/README.md dist/README.md # Make the commit and tag, and push them. -git add package.json bower.json +git add package.json bower.json README.md contrib/*/README.md dist/README.md git commit -n -m "v$VERSION" +git diff --stat --exit-status # check for uncommitted changes git tag -a "v$VERSION" -m "v$VERSION" git push origin "v$VERSION" @@ -126,7 +130,7 @@ git push origin "v$VERSION" npm publish if [ ! -z "$NEXT_VERSION" ]; then - # Go back to master to bump + # Go back to original branch to bump git checkout "$BRANCH" # Edit package.json and bower.json to the right version @@ -137,8 +141,8 @@ if [ ! -z "$NEXT_VERSION" ]; then # development branch, too. Most people will read docs on master. node update-sri.js "${VERSION}" README.md contrib/*/README.md - git add package.json bower.json - git commit -n -m "Bump master to v$NEXT_VERSION-pre" + git add package.json bower.json README.md contrib/*/README.md + git commit -n -m "Bump $BRANCH to v$NEXT_VERSION-pre" git push origin "$BRANCH" # Go back to the tag which has build/katex.tar.gz and build/katex.zip From fc115e1f66a35399bacf1d3f327d5f17e81c4adc Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Sun, 22 Jan 2017 15:28:37 +0100 Subject: [PATCH 2/2] Obtain updated README by using a checkout As the dist directory isn't available on the original branch, we cant use its files to update the SRI hashes. Checking out from the release tag is therefore the better option. A checkout will automatically stage its files. --- release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release.sh b/release.sh index a5a0475b..5593e72d 100755 --- a/release.sh +++ b/release.sh @@ -139,9 +139,9 @@ if [ ! -z "$NEXT_VERSION" ]; then # Refer to the just-released version in the documentation of the # development branch, too. Most people will read docs on master. - node update-sri.js "${VERSION}" README.md contrib/*/README.md + git checkout "v${VERSION}" -- README.md contrib/*/README.md - git add package.json bower.json README.md contrib/*/README.md + git add package.json bower.json git commit -n -m "Bump $BRANCH to v$NEXT_VERSION-pre" git push origin "$BRANCH"