-
Notifications
You must be signed in to change notification settings - Fork 14
/
.travis.yml
96 lines (89 loc) · 4.38 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
language: node_js
# 2*2 matrix for tests
os:
- linux
- windows
node_js:
- 10
- 12
jobs:
include:
# run tests in Node.js stable and publish code coverage
- name: 'Coverage'
node_js: stable
os: linux
script:
- npm run test-unit
- npm run codecov -- -c -Z -f .coverage/coverage-final.json -F unit
# create a new release if $CREATE_RELEASE is set
- stage: Create Release
if: env(CREATE_RELEASE) = true AND type = api AND tag IS blank
os: linux
node_js: 12
git:
depth: false # disable --depth
script:
# fail-fast using set -e
- set -e
# decrypt and ssh-add the deploy-key
- openssl aes-256-cbc -K $encrypted_05f822b6caa8_key -iv $encrypted_05f822b6caa8_iv
-in .github/travis-deploy-key.enc -out /tmp/travis-deploy-key -d
- chmod 600 /tmp/travis-deploy-key
- eval "$(ssh-agent -s)"
- ssh-add /tmp/travis-deploy-key
- rm /tmp/travis-deploy-key
# convert remote URL from HTTPS to SSH
- git remote set-url origin $(git config --get remote.origin.url | sed -E 's#(http.*://)([^/]+)/(.+)$#git@\2:\3#g')
- ssh-keyscan github.com >> ~/.ssh/known_hosts
# create release
- npm run release $PUSH_TO_ORIGIN $PRERELEASE_SUFFIX
- set +e
# publish npm package on tagged builds
- stage: Publish Package
if: tag IS present
os: linux
node_js: 12
git:
depth: false # disable --depth
script:
# fail-fast using set -e
- set -e
# get prerelease suffix from version tag
- TAG=$(echo $TRAVIS_TAG | sed 's/^.*-\([a-z]*\).*$/\1/')
# set to `latest` in case of no suffix
- TAG=$([ "${TAG}" = "$TRAVIS_TAG" ] && echo "latest" || echo $TAG)
# make sure `latest` tag is create from main branch
- '[ "$TAG" = "latest" ] && [ $(git rev-parse HEAD) != $(git rev-parse origin/main) ] && return 1 || return 0'
- set +e
deploy:
edge: true # opt in to dpl v2
provider: npm
tag: $TAG
on:
tags: true
all_branches: true
# update gh-pages docs on main
- stage: Publish Docs
if: branch = main
script: npm run build-docs
before_deploy: openssl aes-256-cbc -K $encrypted_05f822b6caa8_key -iv $encrypted_05f822b6caa8_iv
-in .github/travis-deploy-key.enc -out /tmp/travis-deploy-key -d
deploy:
edge: true # opt in to dpl v2
provider: pages:git
local_dir: out/docs
keep_history: false
deploy_key: /tmp/travis-deploy-key
commit_message: Deploy to %{target_branch}
on:
branch: main
before_install:
- '[[ "$CREATE_RELEASE" == "true" || "$TRAVIS_BRANCH" == "main" ]] && true || unset encrypted_05f822b6caa8_key'
- '[[ "$CREATE_RELEASE" == "true" || "$TRAVIS_BRANCH" == "main" ]] && true || unset encrypted_05f822b6caa8_iv'
- '[[ -z "$TRAVIS_TAG" ]] && unset NPM_API_TOKEN || true'
notifications:
slack:
secure: PuYBCkRXgUKxoFMyTZdYcxplpgW+T/hxq54gsFOcAxN079i7PTD/GmGIgKM1RviCocvroUst5bW3ULk3haYUb8gQSCyAeHzRl00DaoOXshTRjFzJyU6m5wbT/R45dh6ZO2BT6uwlVU95KznieCC+yjlbppPOis8bwxra08ODnsA1L7OeI7fVlKjyh+lPA4qnmuYpNtMfTO5mmHroHBS5nWoB1WctWuZQGSfDYLUr/XrhKkJOBbv7FI7setTroIRF4Rs9nIFEF3mzTuUK5VV6lQAZRzNHKmgD9DmGVeaB5Y4fWEznocV1d6cInsjMr4EyMYziyOFnnPZAk8GZapMDwD0/5E9L5+Q8uXhFhVHYurpZnP+wylqZmnfb4UaFcP96BBaavhfF/ai+LWlLbHiL5b1HX4dlauNfHdq1W1YCILI2Atfr+36rqu3102S6HHkOssoTw09ftLfQHuF6CNYnVE5cS40pupwFZj3o0h9yQnCFDPxlq2ls+hon+PKL9wCHL5Ml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