image: node:latest stages: - prepare - test - build - deploy - release cache: &global_cache key: files: - package-lock.json policy: pull paths: - node_modules/ install-dependencies: stage: prepare script: - npm install cache: <<: *global_cache policy: pull-push lint: stage: test script: - npm run lint cache: <<: *global_cache test: stage: test script: - npm run test:ci cache: <<: *global_cache artifacts: when: always reports: junit: - results.xml build: stage: build script: - npm run build - mv dist ds4 cache: <<: *global_cache artifacts: paths: - ds4 expire_in: 1 week deploy: image: ianayoung/rsync:latest stage: deploy dependencies: - build script: - rsync --delete -az ./ds4/ rsync://${DEPLOYMENT_USER}@${DEPLOYMENT_SERVER}:${DEPLOYMENT_PATH} environment: name: production url: https://vtt.f3l.de/ only: - master resource_group: production release-patch: stage: release before_script: - apt update - apt install --yes jq 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 npm run updateManifest -- --update=${RELEASE_TYPE} npm install RELEASE_VERSION=$(jq -r '.version' < package.json) git add package.json package-lock.json src/system.json git diff git commit -m "release version ${VERSION}" git tag -f latest git tag -f ${RELEASE_VERSION} # git push origin ci-processing:${CI_BUILD_REF_NAME} # git push origin latest -f # git push origin ${RELEASE_VERSION} # only: # - master when: manual