2020-12-23 18:36:41 +01:00
|
|
|
image: node:latest
|
|
|
|
|
|
|
|
stages:
|
2020-12-30 21:51:09 +01:00
|
|
|
- prepare
|
2020-12-27 13:33:53 +01:00
|
|
|
- test
|
|
|
|
- build
|
2020-12-27 15:15:57 +01:00
|
|
|
- deploy
|
2021-01-09 18:20:23 +01:00
|
|
|
- release
|
2020-12-23 18:36:41 +01:00
|
|
|
|
2020-12-27 14:03:14 +01:00
|
|
|
cache: &global_cache
|
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- package-lock.json
|
|
|
|
policy: pull
|
2020-12-23 20:23:44 +01:00
|
|
|
paths:
|
2020-12-30 21:51:09 +01:00
|
|
|
- node_modules/
|
|
|
|
|
|
|
|
install-dependencies:
|
|
|
|
stage: prepare
|
|
|
|
script:
|
|
|
|
- npm install
|
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
policy: pull-push
|
2020-12-27 14:03:14 +01:00
|
|
|
|
2020-12-27 13:33:53 +01:00
|
|
|
lint:
|
|
|
|
stage: test
|
2020-12-23 20:15:28 +01:00
|
|
|
script:
|
|
|
|
- npm run lint
|
2020-12-27 14:03:14 +01:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
2020-12-27 13:33:53 +01:00
|
|
|
|
2020-12-30 21:30:31 +01:00
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
script:
|
2020-12-30 22:46:01 +01:00
|
|
|
- npm run test:ci
|
2020-12-30 21:31:35 +01:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
2020-12-30 22:37:34 +01:00
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
reports:
|
|
|
|
junit:
|
|
|
|
- results.xml
|
2020-12-27 13:33:53 +01:00
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- npm run build
|
2021-01-06 00:59:22 +01:00
|
|
|
- mv dist ds4
|
2020-12-27 14:03:14 +01:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
2020-12-27 15:19:20 +01:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2021-01-06 00:59:22 +01:00
|
|
|
- ds4
|
2020-12-27 16:43:20 +01:00
|
|
|
expire_in: 1 week
|
2020-12-27 16:38:16 +01:00
|
|
|
|
2020-12-27 15:15:57 +01:00
|
|
|
deploy:
|
2020-12-27 20:33:02 +01:00
|
|
|
image: ianayoung/rsync:latest
|
2020-12-27 15:15:57 +01:00
|
|
|
stage: deploy
|
2020-12-27 16:38:16 +01:00
|
|
|
dependencies:
|
|
|
|
- build
|
2020-12-27 15:15:57 +01:00
|
|
|
script:
|
2021-01-06 00:59:22 +01:00
|
|
|
- rsync --delete -az ./ds4/ rsync://${DEPLOYMENT_USER}@${DEPLOYMENT_SERVER}:${DEPLOYMENT_PATH}
|
2020-12-27 16:38:16 +01:00
|
|
|
environment:
|
|
|
|
name: production
|
|
|
|
url: https://vtt.f3l.de/
|
2020-12-27 15:15:57 +01:00
|
|
|
only:
|
|
|
|
- master
|
2021-01-09 01:10:26 +01:00
|
|
|
resource_group: production
|
2021-01-09 18:20:23 +01:00
|
|
|
|
|
|
|
release-patch:
|
|
|
|
stage: release
|
|
|
|
before_script:
|
|
|
|
- apt update
|
2021-01-09 18:23:56 +01:00
|
|
|
- apt install --yes jq
|
2021-01-09 18:20:23 +01:00
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: patch
|
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
script: |
|
|
|
|
REPOSITORY_URL=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|gitlab-ci-token:.*@|${RELEASE_TOKEN}:${RELEASE_TOKEN_SECRET}@|g")
|
|
|
|
git remote set-url origin $REPOSITORY_URL
|
|
|
|
git config user.name $GITLAB_USER_LOGIN
|
|
|
|
git config user.email $GITLAB_USER_EMAIL
|
|
|
|
git branch -D ci-processing || true
|
|
|
|
git checkout -b ci-processing
|
2021-01-09 18:25:57 +01:00
|
|
|
npm run updateManifest -- --update=${RELEASE_TYPE}
|
2021-01-09 18:20:23 +01:00
|
|
|
npm install
|
|
|
|
RELEASE_VERSION=$(jq -r '.version' < package.json)
|
|
|
|
git add package.json package-lock.json src/system.json
|
2021-01-09 18:29:30 +01:00
|
|
|
git diff
|
2021-01-09 18:20:23 +01:00
|
|
|
git commit -m "release version ${VERSION}"
|
|
|
|
git tag -f latest
|
2021-01-09 18:29:30 +01:00
|
|
|
git tag -f ${RELEASE_VERSION}
|
2021-01-09 18:20:23 +01:00
|
|
|
# git push origin ci-processing:${CI_BUILD_REF_NAME}
|
2021-01-09 18:23:56 +01:00
|
|
|
# git push origin latest -f
|
|
|
|
# git push origin ${RELEASE_VERSION}
|
2021-01-09 18:20:23 +01:00
|
|
|
# only:
|
|
|
|
# - master
|
|
|
|
when: manual
|