Skip to content

Commit 0439d39

Browse files
committed
Adding travis settings
1 parent 21f9f81 commit 0439d39

File tree

5 files changed

+79
-5
lines changed

5 files changed

+79
-5
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ yarn-error.log*
2323
.vscode
2424

2525
#build
26-
/build
26+
/build
27+
28+
.env

.npmignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tsconfig.json
2+
tsconfig.test.json
3+
tslint.json
4+
.travis.yml
5+
.npmignore
6+
.package-lock.json
7+
src/
8+
samples/
9+
config/
10+
scripts/

.travis.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
language: node_js
22
node_js:
3-
- "9"
4-
- "8"
5-
- "7"
3+
- '9'
4+
- '8'
5+
- '7'
6+
7+
install:
8+
- npm install
9+
10+
deploy:
11+
- provider: script
12+
skip_cleanup: true
13+
script: .travis/pu.sh
14+
on:
15+
branch: master
16+
tags: false
17+
- provider: npm
18+
19+
api_key:
20+
secure: $NPM_TOKEN
21+
on:
22+
tag: publish

.travis/pu.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
3+
setup_git() {
4+
# Set the user name and email to match the API token holder
5+
# This will make sure the git commits will have the correct photo
6+
# and the user gets the credit for a checkin
7+
git config --global user.email "[email protected]"
8+
git config --global user.name "liliankasem"
9+
git config --global push.default matching
10+
11+
# Get the credentials from a file
12+
git config credential.helper "store --file=.git/credentials"
13+
14+
# This associates the API Key with the account
15+
echo "https://${GITHUB_API_KEY}:@github.com" > .git/credentials
16+
}
17+
18+
make_version() {
19+
# Make sure that the workspace is clean
20+
# It could be "dirty" if
21+
# 1. package-lock.json is not aligned with package.json
22+
# 2. npm install is run
23+
git checkout -- .
24+
25+
# Echo the status to the log so that we can see it is OK
26+
git status
27+
28+
# Run the deploy build and increment the package versions
29+
# %s is the placeholder for the created tag
30+
npm version patch -m "chore: release version %s [skip ci]"
31+
}
32+
33+
upload_files() {
34+
# This make sure the current work area is pushed to the tip of the current branch
35+
git push origin HEAD:$TRAVIS_BRANCH
36+
37+
# This pushes the new tag
38+
git push --tags
39+
}
40+
41+
setup_git
42+
make_version
43+
upload_files

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
"start": "npm install && npm run build && npm --prefix ./sample run start",
8585
"build": "npm run lint && tsc",
8686
"test": "node scripts/test.js --env=jsdom",
87-
"prepublishOnly": "npm run clean && npm install && npm run build"
87+
"prepublishOnly": "npm run clean && npm install && npm run build",
88+
"version": "npm run build && git add .",
89+
"postversion": "git push && git push --tags"
8890
},
8991
"devDependencies": {
9092
"@types/jest": "^22.2.3",

0 commit comments

Comments
 (0)