forked from chunlaw/HKAddressParser
-
Notifications
You must be signed in to change notification settings - Fork 29
/
.travis.yml
56 lines (46 loc) · 1.5 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Travis CI config
# http://docs.travis-ci.com/user/languages/javascript-with-nodejs/
sudo: required
language: node_js
node_js:
- "8"
stages:
- test
# Build the docker image only on master branch
- name: deploy
if: branch = master
env:
global:
- REPO=addressparser
- ORG=g0vhk
cache: npm
services:
- docker
# branches:
# only:
# - master # only run CI on the master branch
# - /^PR / # also build pull requests
before_install:
- cd web
- npm install
jobs:
include:
- stage: deploy
script:
- echo "VUE_APP_GA_TRACKING_ID=$GA_TRACKING_ID" >> .env
# if this is build from tag, just update the tag name, otherise use the previous tag name
- export TRAVIS_TAG=`git describe --tags --exact-match`
- echo $TRAVIS_TAG
- if [[ -z "$TRAVIS_TAG" ]]; then echo "VUE_APP_REV_NAME=$(git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`)" >> .env; fi
- if [[ ! -z "$TRAVIS_TAG" ]]; then echo "VUE_APP_REV_NAME=$TRAVIS_TAG" >> .env; fi
- npm run build
- if [[ ! -z "$DOMAIN" ]]; then echo $DOMAIN >> dist/CNAME; fi
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
keep-history: true
local-dir: web/dist # the local dir is relative to root and ignoring the one set with before_install
on:
tags: true
all_branches: true