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:
|
2021-10-26 23:35:57 +02:00
|
|
|
- test
|
|
|
|
- build
|
2021-12-20 06:10:46 +01:00
|
|
|
- prepare-release
|
2021-10-26 23:35:57 +02:00
|
|
|
- release
|
2021-12-20 06:10:46 +01:00
|
|
|
- publish
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
cache: &global_cache
|
2021-10-26 23:35:57 +02:00
|
|
|
paths:
|
|
|
|
- .yarn/cache
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
lint:
|
2021-10-26 23:35:57 +02:00
|
|
|
stage: test
|
|
|
|
before_script:
|
|
|
|
- yarn install --immutable
|
|
|
|
script:
|
|
|
|
- yarn lint
|
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
reuse:
|
2021-10-26 23:35:57 +02:00
|
|
|
stage: test
|
|
|
|
image:
|
|
|
|
name: fsfe/reuse:latest
|
|
|
|
entrypoint: ['']
|
|
|
|
script:
|
|
|
|
- reuse lint
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
build:
|
2021-10-26 23:35:57 +02:00
|
|
|
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
|
|
|
|
2021-12-20 06:10:46 +01:00
|
|
|
publish-artifacts:
|
|
|
|
stage: prepare-release
|
|
|
|
image: alpine:latest
|
|
|
|
before_script:
|
|
|
|
- apk update
|
|
|
|
- apk add zip curl
|
|
|
|
script: |
|
|
|
|
zip -r darkness-dependent-vision.zip darkness-dependent-vision/*
|
|
|
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/darkness-dependent-vision.zip"
|
|
|
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision/module.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/module.json"
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
|
|
|
|
|
|
|
changelog:
|
|
|
|
stage: prepare-release
|
|
|
|
before_script:
|
|
|
|
- yarn install --immutable
|
|
|
|
script:
|
|
|
|
- yarn changelog
|
|
|
|
cache:
|
|
|
|
<<: *global_cache
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- CHANGELOG.md
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
|
|
|
|
2021-06-29 05:27:27 +02:00
|
|
|
.release-template: &release-template
|
2021-10-26 23:35:57 +02:00
|
|
|
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
|
2021-12-20 06:10:46 +01:00
|
|
|
git commit -m "chore(release): ${RELEASE_VERSION}"
|
2021-10-26 23:35:57 +02:00
|
|
|
git tag -f ${RELEASE_VERSION}
|
2021-12-20 06:10:46 +01:00
|
|
|
git push origin ci-processing:${CI_BUILD_REF_NAME} -o ci.skip
|
2021-10-26 23:35:57 +02:00
|
|
|
git push origin ${RELEASE_VERSION}
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
when: manual
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
release-patch:
|
2021-10-26 23:35:57 +02:00
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: patch
|
|
|
|
<<: *release-template
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
release-minor:
|
2021-10-26 23:35:57 +02:00
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: minor
|
|
|
|
<<: *release-template
|
2021-06-29 05:27:27 +02:00
|
|
|
|
|
|
|
release-major:
|
2021-10-26 23:35:57 +02:00
|
|
|
variables:
|
|
|
|
RELEASE_TYPE: major
|
|
|
|
<<: *release-template
|
2021-12-20 06:10:46 +01:00
|
|
|
|
|
|
|
release:
|
|
|
|
stage: release
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
script:
|
|
|
|
- echo 'release job'
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
|
|
|
release:
|
|
|
|
tag_name: $CI_COMMIT_TAG
|
|
|
|
description: './CHANGELOG.md'
|
|
|
|
assets:
|
|
|
|
links:
|
|
|
|
- name: 'darkness-dependent-vision.zip'
|
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/darkness-dependent-vision.zip'
|
|
|
|
filepath: /darkness-dependent-vision.zip
|
|
|
|
link_type: package
|
|
|
|
- name: 'module.json'
|
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/module.json'
|
|
|
|
filepath: /module.json
|
|
|
|
link_type: other
|
|
|
|
|
|
|
|
publish-latest-manifest:
|
|
|
|
stage: publish
|
|
|
|
image: alpine:latest
|
|
|
|
before_script:
|
|
|
|
- apk update
|
|
|
|
- apk add zip curl
|
|
|
|
script: |
|
|
|
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision/module.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/latest/module.json"
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
|
|
|
|
|
|
|
publish-to-foundry-admin:
|
|
|
|
stage: publish
|
|
|
|
image: johannesloher/foundry-publish
|
|
|
|
variables:
|
|
|
|
FVTT_MANIFEST_PATH: darkness-dependent-vision/module.json
|
|
|
|
FVTT_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/module.json
|
|
|
|
script: foundry-publish
|
|
|
|
rules:
|
|
|
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|