-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
43 lines (35 loc) · 1.15 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
language: node_js
sudo: required
node_js:
- "12.14.1"
cache:
yarn: true
directories:
- node_modules
env:
global:
- PROJECT="Leopard-UI"
- ROLE="WebUI"
- PACKAGE_VERSION="v1.0.${TRAVIS_BUILD_NUMBER}"
addons:
sonarcloud:
organization: "seds"
before_script:
- export ARTIFACT_NAME="${PROJECT}-${ROLE}-${TRAVIS_BRANCH}-${PACKAGE_VERSION}.zip"
- export TAG=`echo "$PROJECT-$ROLE:$TRAVIS_BRANCH-$PACKAGE_VERSION" | tr '[:upper:]' '[:lower:]'`
- export TAG_LATEST=`echo "$PROJECT-$ROLE:$TRAVIS_BRANCH-latest" | tr '[:upper:]' '[:lower:]'`
script:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then sonar-scanner -Dsonar.projectVersion=${PACKAGE_VERSION}; fi'
- yarn run prod
- echo -n "${PACKAGE_VERSION}" > dist/version.txt
before_deploy:
- cd ./dist && zip -r ../${ARTIFACT_NAME} ./ && cd ..
- 'curl -o upload.sh -H "Authorization: token ${GITHUB_TOKEN}" ${GITHUB_UPLOAD_SCRIPT}'
- chmod a+x ./upload.sh
deploy:
- provider: script
skip_cleanup: true
on:
all_branches: true
script:
- ./upload.sh ${ARTIFACT_NAME} ${PROJECT} ${TRAVIS_BRANCH} ${ROLE} ${PACKAGE_VERSION} ${OSS_BUCKET} ${OSS_KEY} ${OSS_SECRET}