darkness-dependent-vision/.gitlab-ci.yml

92 lines
2 KiB
YAML
Raw Permalink Normal View History

2021-06-29 05:27:27 +02:00
# SPDX-FileCopyrightText: 2021 Johannes Loher
# SPDX-FileCopyrightText: 2021 Oliver Rümpelein
#
# SPDX-License-Identifier: MIT
image: node:lts
stages:
- test
- build
- release
2021-06-29 05:27:27 +02:00
cache: &global_cache
paths:
- .yarn/cache
2021-06-29 05:27:27 +02:00
lint:
stage: test
before_script:
- yarn install --immutable
script:
- yarn lint
cache:
<<: *global_cache
2021-06-29 05:27:27 +02:00
reuse:
stage: test
image:
name: fsfe/reuse:latest
entrypoint: ['']
script:
- reuse lint
2021-06-29 05:27:27 +02:00
build:
stage: build
before_script:
- yarn install --immutable
- if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi
script:
- yarn build
- mv dist darkness-dependent-vision
cache:
<<: *global_cache
artifacts:
paths:
- darkness-dependent-vision
expire_in: 1 week
2021-06-29 05:27:27 +02:00
.release-template: &release-template
stage: release
before_script:
- yarn install --immutable
- apt update
- apt install --yes jq
- 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
cache:
<<: *global_cache
script: |
yarn bump-version --release=${RELEASE_TYPE}
RELEASE_VERSION=$(jq -r '.version' < package.json)
git add package.json src/module.json
git --no-pager diff
git commit -m "release version ${RELEASE_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
2021-06-29 05:27:27 +02:00
release-patch:
variables:
RELEASE_TYPE: patch
<<: *release-template
2021-06-29 05:27:27 +02:00
release-minor:
variables:
RELEASE_TYPE: minor
<<: *release-template
2021-06-29 05:27:27 +02:00
release-major:
variables:
RELEASE_TYPE: major
<<: *release-template