Skip to content

Commit 0c21a5b

Browse files
committed
chore: enable continues deployment
1 parent 39f3d76 commit 0c21a5b

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ dist
88
!.babelrc
99
!.travis.yml
1010
!.eslintrc
11+
!.scripts

.scripts/release.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
if [[ $TRAVIS_PULL_REQUEST = "true" ]]; then
5+
echo 'This is a pull request. Exiting the release script.'
6+
7+
exit 0
8+
fi
9+
10+
if [[ $TRAVIS_BRANCH = "master" ]]; then
11+
echo 'This is not a master branch. Exiting the release script.'
12+
13+
exit 0
14+
fi
15+
16+
if [[ $TRAVIS_TAG != "" ]]; then
17+
echo 'This is a tag release.'
18+
19+
# Use NPM_TOKEN to enable NPM authentication
20+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
21+
22+
NODE_ENV=development npm install
23+
NODE_ENV=production npm run build
24+
25+
npm publish
26+
exit 0
27+
fi
28+
29+
if [[ $(git log --format=%B -n 1 $TRAVIS_COMMIT) == *"chore: release"* ]]; then
30+
echo 'This is a tag release. Exiting the release script.'
31+
32+
exit 0
33+
fi;
34+
35+
git config --global user.name 'continuous-deployment'
36+
git config --global user.email 'continuous-deployment@travis'
37+
38+
# Use GITHUB_TOKEN to enable GitHub authentication
39+
git config credential.helper "store --file=.git/credentials"
40+
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
41+
42+
git checkout master
43+
git merge $TRAVIS_COMMIT
44+
45+
# 1. bump the package.json version (based on your commit history)
46+
# 2. update CHANGELOG.md
47+
# 3. commit package.json and CHANGELOG.md
48+
# 4. tag the release
49+
standard-version --message "chore: release %s"
50+
51+
git push --follow-tags origin master

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ script:
99
- npm run test
1010
- npm run lint
1111
- npm run build
12+
after_success:
13+
- travis-after-all && ./.scripts/release.sh

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"create-index": "0.1.3",
3535
"eslint": "^3.3.1",
3636
"eslint-config-canonical": "^1.7.16",
37-
"mocha": "^3.0.2"
37+
"mocha": "^3.0.2",
38+
"standard-version": "^2.4.0",
39+
"travis-after-all": "^1.4.4"
3840
},
3941
"scripts": {
4042
"create-index": "create-index --update-index ./src/utilities",

0 commit comments

Comments
 (0)