Skip to content

Commit

Permalink
build(release script): Enhance the release script for running locally.
Browse files Browse the repository at this point in the history
Also add the generate-changelog package to generate a nice Changelog.
  • Loading branch information
ryanoglesby08 committed Jul 19, 2017
1 parent 2ad01ad commit 13c49b3
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 146 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
],
"scripts": {
"precommit": "yarn lint && yarn test && yarn build",
"prerelease": "scripts/prerelease.sh",
"release": "scripts/release.sh",
"release:changelog": "changelog",
"lint": "yarn lint:js && yarn lint:scss",
"lint:js": "eslint src --ext '.js,.jsx' --config config/.eslintrc.json",
"lint:scss": "stylelint 'src/scss/**/*.scss' --config config/.stylelintrc.json",
Expand Down Expand Up @@ -55,6 +56,7 @@
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "^7.1.0",
"generate-changelog": "^1.3.0",
"jest": "^20.0.4",
"jest-enzyme": "^3.5.3",
"node-sass": "^4.5.3",
Expand Down
68 changes: 0 additions & 68 deletions scripts/changelog.sh

This file was deleted.

50 changes: 0 additions & 50 deletions scripts/prerelease.sh

This file was deleted.

68 changes: 68 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash

set -e

VERSION_NUM="$1"
VERSION_TAG="v$1"

#
# Validate the given semantic version number.
#
if ! [[ "$VERSION_NUM" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Please give a semantic version number, such as 1.2.3. "
echo "Usage: yarn prerelease -- <version>"

exit 1
fi

#
# Scan git tags to ensure the given semantic version number doesn't already exist.
#
if [[ `git tag | grep $VERSION_TAG` ]]; then
echo "Version ${VERSION_TAG} already exists."
echo "Usage: yarn prerelease -- <version>"

exit 1
fi

#
# Make sure there are no uncommitted local changes.
#
if [[ `git status --porcelain` ]]; then
echo "You have uncommitted changes. Either commit them, revert them, or stash them and then try again."
exit 1
fi

#
# Make sure codebase is in working order.
#
yarn precommit

#
# Bump the version. Don't create a tag yet so that we can add the Changelog into the commit.
#
yarn version --no-git-tag-version --new-version $VERSION_NUM

#
# Update the Changelog.
#
yarn release:changelog

#
# Prompt before pushing to give you a chance to make any manual corrections.
#
read -p "Are you ready to make the release? (y/n) " -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi

#
# Create a commit and tag and push!
#
git add CHANGELOG.md package.json

git commit -m "$VERSION_TAG"
git tag $VERSION_TAG

git push origin master
git push origin $VERSION_TAG
46 changes: 19 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ block-stream@*:
dependencies:
inherits "~2.0.0"

bluebird@^3.4.7:
bluebird@^3.0.6, bluebird@^3.4.7:
version "3.5.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"

Expand Down Expand Up @@ -1292,14 +1292,10 @@ caniuse-api@^1.5.2:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"

caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
caniuse-db@^1.0.30000187, caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
version "1.0.30000702"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000702.tgz#a60cd30f3ef44ae7b5ed12e9d9b70d4bff6352cb"

caniuse-db@^1.0.30000529:
version "1.0.30000703"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000703.tgz#c7d899b8adea6da1aa587355d39ac8533f878403"

caniuse-lite@^1.0.30000697, caniuse-lite@^1.0.30000701:
version "1.0.30000702"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000702.tgz#bd66e40345528fe0c001917d1d3f55454df634f1"
Expand Down Expand Up @@ -2882,6 +2878,14 @@ gaze@^1.0.0:
dependencies:
globule "^1.0.0"

generate-changelog@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/generate-changelog/-/generate-changelog-1.3.0.tgz#90510b8c27ecff9ffc33243d412e6bc37bca034b"
dependencies:
bluebird "^3.0.6"
commander "^2.9.0"
github-url-from-git "^1.4.0"

generate-function@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74"
Expand Down Expand Up @@ -2916,6 +2920,10 @@ github-slugger@^1.1.3:
dependencies:
emoji-regex ">=6.0.0 <=6.1.1"

github-url-from-git@^1.4.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/github-url-from-git/-/github-url-from-git-1.5.0.tgz#f985fedcc0a9aa579dc88d7aff068d55cc6251a0"

glob-base@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
Expand Down Expand Up @@ -4470,11 +4478,7 @@ miller-rabin@^4.0.0:
bn.js "^4.0.0"
brorand "^1.0.1"

"mime-db@>= 1.27.0 < 2":
version "1.29.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878"

mime-db@~1.27.0:
"mime-db@>= 1.27.0 < 2", mime-db@~1.27.0:
version "1.27.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1"

Expand Down Expand Up @@ -5385,22 +5389,14 @@ postcss@^5.0.0, postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.
source-map "^0.5.6"
supports-color "^3.2.3"

postcss@^6.0.0, postcss@^6.0.3, postcss@^6.0.6, postcss@^6.0.7:
postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.3, postcss@^6.0.6, postcss@^6.0.7:
version "6.0.7"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.7.tgz#6a097477c46d13d0560a817d69abc0bae549d0a0"
dependencies:
chalk "^2.0.1"
source-map "^0.5.6"
supports-color "^4.2.0"

postcss@^6.0.1:
version "6.0.8"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.8.tgz#89067a9ce8b11f8a84cbc5117efc30419a0857b3"
dependencies:
chalk "^2.0.1"
source-map "^0.5.6"
supports-color "^4.2.0"

prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
Expand Down Expand Up @@ -5497,11 +5493,11 @@ public-encrypt@^4.0.0:
parse-asn1 "^5.0.0"
randombytes "^2.0.1"

punycode@1.3.2:
punycode@1.3.2, punycode@^1.2.4:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"

punycode@^1.2.4, punycode@^1.4.1:
punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"

Expand Down Expand Up @@ -6213,14 +6209,10 @@ sass-loader@^6.0.6:
lodash.tail "^4.1.1"
pify "^3.0.0"

sax@1.2.1, sax@>=0.6.0, sax@^1.2.1:
sax@1.2.1, sax@>=0.6.0, sax@^1.2.1, sax@~1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a"

sax@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"

schema-utils@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf"
Expand Down

0 comments on commit 13c49b3

Please sign in to comment.