forked from postmanlabs/postman-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
98 lines (91 loc) · 4.42 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
97
98
language: node_js
# 2*2 matrix for tests
os:
- linux
- windows
node_js:
- 10
- 12
jobs:
include:
# run tests in latest LTS Node.js release and publish code coverage
- name: 'Coverage'
os: linux
node_js: lts/*
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
os: linux
node_js: 12
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+36rqu3102S6HHkOssoTw09ftLfQHuF6CNYnVE5cS40p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