-
Notifications
You must be signed in to change notification settings - Fork 12
/
.travis.yml
80 lines (74 loc) · 3.76 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
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'
os: linux
node_js: stable
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: osx
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
before_install:
- '[[ -z "$CREATE_RELEASE" ]] && unset encrypted_05f822b6caa8_key || true'
- '[[ -z "$CREATE_RELEASE" ]] && unset encrypted_05f822b6caa8_iv || true'
- '[[ -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+PKL9wCHL5MlG+jQZDDL8eZC8F9CoZUyVIxNhoh0fnZ+t4bIlGW5eB8f8oMCxcnjocxZpichfAsmuaPh/e2KfdoF/B7ce6+Tb3/YXqo5QVTsJ1Vzi4I7c3jx1Q0DAyZODsBKyE0y7NfmeVNap0WIgajiJBoKji8Fjw+tDfa3hSb4yyPSG6w=
webhooks:
urls:
secure: GTWyny+NiqjXBd3lzcgOgq0H3LsI3NP7IUK0uFcz88AUdeSVVW1+nq81uzuFvl8BYqs8T95l7DvltyLQMxsWYCUHVg0WqOKNMgxMAjYZN+lfvdpohY1cp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