Skip to content

Commit

Permalink
chore(release): Add release automation
Browse files Browse the repository at this point in the history
Add publish script and process documentation.
Add npm script to publish to npm.
Update `build:dist` to use cross-env library.
Updates npmignore to clean up deployment package.
  • Loading branch information
joshwiens committed Aug 6, 2016
1 parent e7d16e3 commit fcc2d60
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
example/
example
scripts
src
test
.github
.gitattributes
.babelrc
.editorconfig
.eslintignore
.eslintrc
.travis.yml
CONTRIBUTING.md
webpack.config.babel.js
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"test.integration": "npm run build && karma start --single-run",
"travis": "npm run test.unit && npm run test.integration",
"generate.changelog": "node scripts/release/generate-changelog.js",
"publish.version": "npm run build:dist && sh scripts/release/npm-publish.sh",
"build:dev": "webpack",
"build:dist": "NODE_ENV='production' webpack"
"build:dist": "cross-env NODE_ENV=production webpack"
},
"repository": {
"type": "git",
Expand Down
16 changes: 16 additions & 0 deletions scripts/release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
###Tag and Release process

> Starting from a state where everything is in master that we want released.
*The GitHub Portion*
* Increment the version in the package.json and save.
* Generate the changelog for the new release version `npm run generate.changelog`.
* Run `git add .` to stage the changes.
* Commit changelog & package version updates as `chore(release): karma-webpack <package version>`.
* Run `git push` to send the changes to origin.
* Run `git tag <package version>` to create our release tag.
* Run `git push --tags` to send the tag to origin.

*The NPM Portion*
* `npm login` to the user with rights to publish to NPM
* `npm run publish.version` which executes a `dist` build and publishes using the tag created above.
27 changes: 27 additions & 0 deletions scripts/release/npm-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Accepts a single argument as the tag for the release (such as "next").
# Run this script from the root of the repo.

# `npm whoami` errors and dies if you're not logged in,
# so we redirect the stderr output to /dev/null since we don't care.
NPM_USER=$(npm whoami 2> /dev/null)

if [ "${NPM_USER}" != "mikaak" ]; then
echo "Publishing limited to 'mikaak'. Did you forget to 'npm login'."
exit
fi

# Defaults to latest github tag
NPM_TAG="latest"
if [ "$1" ] ; then
NPM_TAG=${1}
fi

# Sets the above
set -ex

# Publishing the defined tag to npm
npm publish --access public --tag ${NPM_TAG}

# Logs out of npm when publish is complete.
npm logout

0 comments on commit fcc2d60

Please sign in to comment.