Newer
Older
image: registry.gitlab.tugraz.at/dbp/web-components/toolkit/main:v1
cache:
key: ${CI_PROJECT_PATH}
paths:
- _yarn_cache
- yarn config set cache-folder "$CI_PROJECT_DIR/_yarn_cache"
- yarn install
- yarn run test
publish:
stage: publish
only:
refs:
- publish
- master
# https://www.npmjs.com/settings/dbp-deploy/tokens
# NPM_TOKEN needs to be a "Publish" token with 2FA disabled!
# "Automation" tokens don't work with lerna (even if they would work with "npm publish")
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ~/.npmrc
- yarn config set cache-folder "$CI_PROJECT_DIR/_yarn_cache"
- yarn install
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
.deploy_defaults: &deploy_defaults
except:
- schedules
stage: deploy
script:
# Add ssh key
- mkdir -p ~/.ssh
- echo "${DEPLOY_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
# Deploy
- dep deploy "${CI_ENVIRONMENT_NAME}"
- echo "Deployed to ${CI_ENVIRONMENT_URL}"
# Simple health check
- curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}"
deploy_demo:
only:
refs:
- demo
environment:
name: demo
url: https://frontend-demo.tugraz.at/apps/demo
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_development:
only:
refs:
- master
environment:
name: development
url: https://mw-frontend-dev.tugraz.at/apps/demo
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults