From 917d4981a9365d2a65b19e9d54bf439af6606153 Mon Sep 17 00:00:00 2001 From: Teng-hao Chang Date: Thu, 26 Oct 2017 10:10:01 +0800 Subject: [PATCH 1/5] Revise deploy with Travis script provider --- .travis.yml | 20 ++++++++++++++------ package.json | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f49b9b9e..95376846 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,13 +17,21 @@ before_script: - yarn lint - yarn test -script: - # Auth NPM for later release +before_deploy: - npm config set //registry.npmjs.org/:_authToken=\${NPM_TOKEN} - # Publish canary builds when feature merges back to develop - - "if [ ${TRAVIS_PULL_REQUEST} = 'false' ] && [ ${TRAVIS_BRANCH} = 'develop' ]; then yarn canary ; fi" - # Publish release builds when merges to master - - "if [ ${TRAVIS_PULL_REQUEST} = 'false' ] && [ ${TRAVIS_BRANCH} = 'master' ]; then sh ./scripts/deploy.sh ; fi" + +deploy: + - provider: script + script: yarn canary + skip_cleanup: true + on: + branch: develop + + - provider: script + script: yarn release && yarn ghpages + skip_cleanup: true + on: + branch: master # Send coverage data to Coveralls after_script: diff --git a/package.json b/package.json index 9588c7db..5c432550 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "scripts": { "prepublish": "lerna run prepublish", "start": "lerna run storybook --stream", - "release": "lerna publish -m \"Lerna publish %s\" --yes --repo-version $PACKAGE_VERSION", + "bumpversion": "lerna publish -m \"Bump version to %s\" --skip-npm", + "release": "lerna publish --yes --repo-version $PACKAGE_VERSION --skip-git", "canary": "lerna publish -c --yes", "ghpages": "lerna run ghpages", "lint": "npm run lint:eslint && npm run lint:stylelint", From 4c7ca3b75f46c8e33ad3f56f1665f0b58f448822 Mon Sep 17 00:00:00 2001 From: Teng-hao Chang Date: Thu, 26 Oct 2017 10:14:39 +0800 Subject: [PATCH 2/5] Update README about how to release a version --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 0c8f7836..821fcfff 100644 --- a/README.md +++ b/README.md @@ -66,5 +66,16 @@ Gypcrete does not publish develop builds to the `dist` branch anymore. It now pu * When pushed to `develop` branch --> publish a canary build * When pushed to `master` branch --> publish a relase build +### Releasing +When releasing a new build for Gypcrete, create a release branch `release/x.y.z` and bump version first by: +```sh +yarn bumpversion +``` + +This will run `lerna publish`, which updates all `package.json` files in `packages/`, commits the changes with pre-configured message and tags that commit. + +Then create a pull request for this release branch. +Once it's merged into `master`, it should trigger `yarn release` and publishes packages to npm. + ## LICENSE This project is licensed under the terms of the [Apache License 2.0](https://github.com/ichef/gypcrete/blob/master/LICENSE) From a53c01c8cd6387295672bbbf08605556eb92b552 Mon Sep 17 00:00:00 2001 From: Teng-hao Chang Date: Thu, 26 Oct 2017 10:14:57 +0800 Subject: [PATCH 3/5] Remove unused code --- scripts/deploy.sh | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100644 index f51dcbee..00000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -xe - -# Setup git -git config --global user.name "ichefbot" -git config --global user.email "developer@ichef.com.tw" -git remote add origin-pages "https://${GH_TOKEN}@${GH_REPO}" > /dev/null 2>&1 - -git checkout master -yarn release --git-remote origin-pages -yarn ghpages From b0dcf91e7994ef1696ab3f064f2cefece16583cc Mon Sep 17 00:00:00 2001 From: Teng-hao Chang Date: Thu, 26 Oct 2017 10:24:04 +0800 Subject: [PATCH 4/5] Move 'yarn test' to script stage on Travis to prevent running tests twice --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 95376846..ebe18702 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ install: before_script: - yarn flow - yarn lint + +script: - yarn test before_deploy: From 5d9ba64409dfa8f425ad85e5701224b60b12ce1a Mon Sep 17 00:00:00 2001 From: Teng-hao Chang Date: Thu, 26 Oct 2017 11:01:36 +0800 Subject: [PATCH 5/5] Only send coverage data when tests pass --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ebe18702..9a05d3bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,10 @@ before_script: script: - yarn test +# Send coverage data to Coveralls +after_success: + - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + before_deploy: - npm config set //registry.npmjs.org/:_authToken=\${NPM_TOKEN} @@ -35,10 +39,6 @@ deploy: on: branch: master -# Send coverage data to Coveralls -after_script: - - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js - branches: only: - master