This repository has been archived by the owner on Dec 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
.travis.yml
78 lines (68 loc) · 2.52 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# The following two lines are currently required to build on Ubuntu trusty, which makes installing easier (e.g. woff-tools from main repository)
sudo: required
dist: trusty
language: node_js
node_js:
- "4.1"
- "4.0"
- "0.12"
- "0.11"
- "0.10"
before_install:
- sudo apt-get update -qq
install:
- export rvmsudo_secure_path=1
- sudo apt-get install -qq fontforge woff-tools zlib1g-dev
- rvmsudo gem install fontcustom
- npm install
script:
- npm run check
- scripts/check_build
deploy:
provider: releases
api_key: "${GH_TOKEN}"
file: "build/dist/traffico.zip"
skip_cleanup: true
on:
tags: true
node: "4.1"
# Automatically deploys a tagged release to GitHub pages if the Travis build succeeds
after_success: |
if [ "$TRAVIS_TAG" == "" ]; then
echo "Not a tagged release, so GitHub pages are not updated!"
elif [ "$TRAVIS_NODE_VERSION" != "4.1" ]; then
echo "This is Node $TRAVIS_NODE_VERSION, releases are only produced by Node 4.1"
else
# Config
masterCommit=`git rev-parse HEAD`
git config --global user.email "deploy@travis"
git config --global user.name "Travis CI"
# This avoids printout of the token when pushing
git config --global credential.helper store
echo "https://${GH_USERNAME}:${GH_TOKEN}@github.com" > $HOME/.git-credentials
printf "\nCloning the release-repo and the gh-pages branch...\n"
git clone --depth=1 --branch=master https://github.com/mapillary/traffico-release.git ../traffico-release
git clone --depth=1 --branch=gh-pages https://github.com/mapillary/traffico.git ../traffico-pages
printf "\nRemoving old assets from release repo..."
cd ../traffico-release
git rm -r .
printf "\nUnzipping release into release repo..."
cd ../traffico
unzip -o build/dist/traffico.zip -d ../traffico-release
printf "\nCopy website resources into gh-pages branch...\n"
cd ../traffico
cp build/gh-pages/examples.html build/gh-pages/_config.yml ../traffico-pages/
cp -T build/gh-pages/examples.scss ../traffico-pages/_sass/pages/_examples.scss
printf "\nCommitting and pushing to release repo..."
cd ../traffico-release
git add --all .
git commit -m "Drop in $TRAVIS_TAG"
git tag "$TRAVIS_TAG"
git push origin master "$TRAVIS_TAG"
printf "\nCommitting and pushing to gh-pages branch...\n"
cd ../traffico-pages
git commit -a -m "Bump gh-pages to $TRAVIS_TAG
This commit has automatically been crafted by Travis CI based on $masterCommit."
git push origin gh-pages
cd ../traffico
fi