Skip to content

Commit 84c1bbf

Browse files
committed
setting up for bower publishing and automatic tagging
1 parent 1a01e00 commit 84c1bbf

File tree

8 files changed

+82
-3
lines changed

8 files changed

+82
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ test/resources/tts-auth.json
88
doc/
99
*-auth.json
1010
.env
11-
dist/*.min.js
1211
examples/static/webpack-bundle.js
1312
examples/node_modules/
13+
dist/*.js

bower.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "watson-speech",
3+
"description": "IBM Watson Speech to Text and Text to Speech SDK for web browsers.",
4+
"main": "dist/watson-speech.min.js",
5+
"authors": [
6+
"Nathan Friedly <http://nfriedly.com>"
7+
],
8+
"license": "Apache-2.0",
9+
"keywords": [
10+
"voice",
11+
"recognition",
12+
"speech",
13+
"text",
14+
"transcription",
15+
"synthesis"
16+
],
17+
"moduleType": [
18+
"amd",
19+
"globals",
20+
"node"
21+
],
22+
"homepage": "https://watson-speech.mybluemix.net/",
23+
"ignore": [
24+
"**/*",
25+
"!dist/*.js"
26+
]
27+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"minify": "uglifyjs --compress --mangle --screw-ie8 dist/watson-speech.js --output dist/watson-speech.min.js --preamble \"// IBM Watson Speech JavaScript SDK\n// $npm_package_version\n// Generated at `date`\n// Copyright IBM ($npm_package_license)\n// $npm_package_homepage\"",
1616
"watchify": "watchify index.js --standalone WatsonSpeech --outfile dist/watson-speech.js --debug --verbose",
1717
"build": "npm run webpack && npm run minify",
18-
"doc": "jsdoc -c jsdoc/config.json --debug",
18+
"doc": "jsdoc -c scripts/jsdoc/config.json --debug",
1919
"watch-doc": "nodemon --watch ./ --ignore ./doc --ext js,tmpl,json --exec npm run doc"
2020
},
2121
"author": "Nathan Friedly <http://nfriedly.com>",

scripts/create_semver_tag.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Looks for [semver major], [semver minor], and [semver patch] in the commit message,
4+
# and run npm version {version} to bump and tag if found.
5+
# Then pushes back to github to cause a new travis build that will publish the new version.
6+
7+
# checking the build/job numbers allows it to only publish once even though we test against multiple node.js versions
8+
# The ".1" job is the first on the list in .travis.yml. By convention, this is the oldest supported node.js version.
9+
10+
#config
11+
# get a token from https://github.com/settings/tokens with the `public_repo` scope and encrypt it like so:
12+
# travis encrypt --add -r user-org-name/repo-name 'GH_TOKEN=xxxxxxxxxxxxxxxxxxx'
13+
# then set the below vars and make sure travis runs this script in the "after_success" section
14+
export REPO="watson-developer-cloud/node-sdk"
15+
export BRANCH="master"
16+
17+
18+
if [ "$TRAVIS_REPO_SLUG" == "$REPO" ] \
19+
&& [ "$TRAVIS_PULL_REQUEST" == "false" ] \
20+
&& [ "$TRAVIS_BRANCH" == "$BRANCH" ] \
21+
&& [ "$TRAVIS_BUILD_NUMBER.1" == "$TRAVIS_JOB_NUMBER" ] \
22+
&& [[ "$TRAVIS_COMMIT_MESSAGE" =~ \[semver\ (major|minor|patch)\] ]] \
23+
; then
24+
25+
export SEMVER=${BASH_REMATCH[1]};
26+
echo "Creating semver $SEMVER per commit message"
27+
28+
# checkout the branch that the commit is actually on instead of "detached head" state
29+
git checkout $BRANCH
30+
31+
# set up git
32+
git config --global push.default simple
33+
git config --global user.email "[email protected]"
34+
git config --global user.name "travis-ci"
35+
git config remote.origin.url https://${GH_TOKEN}@github.com/${REPO}
36+
37+
# Commit the build for bower
38+
npm run build
39+
git add dist/
40+
git commit dist/ -m "building dist/ for release"
41+
42+
# create the tag
43+
npm version $SEMVER
44+
45+
git push --follow-tags
46+
47+
else
48+
49+
echo -e "Not creating a semver tag for build $TRAVIS_JOB_NUMBER on branch $TRAVIS_BRANCH of repo $TRAVIS_REPO_SLUG with commit message:"
50+
echo $TRAVIS_COMMIT_MESSAGE
51+
52+
fi
File renamed without changes.
File renamed without changes.

jsdoc/publish.sh renamed to scripts/jsdoc/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if [ "$TRAVIS_REPO_SLUG" == "watson-developer-cloud/speech-javascript-sdk" ] &&
2828
ln -s ./$TRAVIS_TAG latest
2929
fi
3030

31-
../jsdoc/generate_index_html.sh > index.html
31+
generate_index_html.sh > index.html
3232

3333
git add -f -A .
3434
git commit -m "JSDdoc for $TRAVIS_BRANCH ($TRAVIS_COMMIT)"
File renamed without changes.

0 commit comments

Comments
 (0)