Skip to content

Commit 6787f6d

Browse files
committed
feat(build): add travis configuration
1 parent 9c4eead commit 6787f6d

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

.travis-deploy.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
echo Deploy to GitHub Pages
4+
5+
# only deploy tags
6+
if [ -z "$TRAVIS_TAG" ]; then
7+
8+
echo Deploy to GitHub Pages - Skip deployment
9+
10+
else
11+
12+
echo Deploy to GitHub Pages - Start
13+
14+
# go to the directory which contains build artifacts and create a *new* Git repo
15+
# directory may be different based on your particular build process
16+
cd dist/some-app
17+
git init
18+
19+
# inside this git repo we'll pretend to be a new user
20+
git config user.name "Travis CI"
21+
git config user.email "tomas.trajan@gmail.com"
22+
23+
# The first and only commit to this new Git repo contains all the
24+
# files present with the commit message "Deploy to GitHub Pages".
25+
git add .
26+
git commit -m "Deploy to GitHub Pages"
27+
28+
# Force push from the current repo's master branch to the remote
29+
# repo's gh-pages branch. (All previous history on the gh-pages branch
30+
# will be lost, since we are overwriting it.) We redirect any output to
31+
# /dev/null to hide any sensitive credential data that might otherwise be exposed.
32+
# tokens GH_TOKEN and GH_REF will be provided as Travis CI environment variables
33+
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
34+
35+
echo Deploy to GitHub Pages - Success
36+
37+
fi
38+
39+
echo Deploy to GitHub Pages - Finish

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: node_js
2+
node_js:
3+
- "10"
4+
sudo: required
5+
dist: trusty
6+
addons:
7+
chrome: stable
8+
cache:
9+
directories:
10+
- $HOME/.npm
11+
before_install:
12+
- export CHROME_BIN=chromium-browser
13+
- export DISPLAY=:99.0
14+
- sh -e /etc/init.d/xvfb start
15+
install:
16+
- npm install codecov -g
17+
- npm ci
18+
script:
19+
# run build script specified in package.json
20+
- npm run ci
21+
# call script for deploying of produced artifacts
22+
- bash ./.travis-deploy.sh
23+
after_success:
24+
- codecov

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"build": "ng build",
88
"test": "ng test",
99
"lint": "ng lint",
10-
"e2e": "ng e2e"
10+
"e2e": "ng e2e",
11+
"ci": "ng build --project @my-org/some-lib && ng build --prod"
1112
},
1213
"private": true,
1314
"dependencies": {

0 commit comments

Comments
 (0)