2021-02-16 04:06:43 +01:00
|
|
|
image: node:lts
|
2021-02-07 16:01:14 +01:00
|
|
|
|
|
|
|
stages:
|
2021-02-07 16:03:35 +01:00
|
|
|
- test
|
2021-02-07 16:01:14 +01:00
|
|
|
- build
|
|
|
|
- release
|
|
|
|
|
2021-02-16 04:06:43 +01:00
|
|
|
before_script:
|
|
|
|
- yarn install --immutable
|
|
|
|
|
2021-02-07 16:01:14 +01:00
|
|
|
cache: &global_cache
|
|
|
|
paths:
|
2021-02-16 04:06:43 +01:00
|
|
|
- .yarn/cache
|
2021-02-07 16:01:14 +01:00
|
|
|
|
|
|
|
lint:
|
|
|
|
stage: test
|
|
|
|
script:
|
2021-02-16 04:06:43 +01:00
|
|
|
- yarn lint
|
2021-02-07 16:01:14 +01:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
2021-02-16 04:06:43 +01:00
|
|
|
- yarn build
|
2021-02-07 19:49:23 +01:00
|
|
|
- mv dist risk-dice-modifier
|
2021-02-07 16:01:14 +01:00
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
artifacts:
|
|
|
|
paths:
|
2021-02-07 19:06:21 +01:00
|
|
|
- risk-dice-modifier
|
2021-02-07 16:01:14 +01:00
|
|
|
expire_in: 1 week
|
|
|
|
|
|
|
|
.release-template: &release-template
|
|
|
|
stage: release
|
|
|
|
before_script:
|
2021-02-16 04:06:43 +01:00
|
|
|
- yarn install
|
2021-02-07 16:01:14 +01:00
|
|
|
- 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: |
|
2021-05-23 02:46:03 +02:00
|
|
|
yarn bump-version --release=${RELEASE_TYPE}
|
2021-02-07 16:01:14 +01:00
|
|
|
RELEASE_VERSION=$(jq -r '.version' < package.json)
|
2021-05-23 02:46:03 +02:00
|
|
|
git add package.json src/module.json
|
2021-02-07 16:01:14 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
release-patch:
|
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: patch
|
|
|
|
<<: *release-template
|
|
|
|
|
|
|
|
release-minor:
|
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: minor
|
|
|
|
<<: *release-template
|
|
|
|
|
|
|
|
release-major:
|
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: major
|
|
|
|
<<: *release-template
|