Merge branch 'woodpecker' into 'master'
ci: switch from GitLab CI to Woodpecker CI See merge request saluu/darkness-dependent-vision!29
This commit is contained in:
commit
5967a222ba
6 changed files with 151 additions and 164 deletions
161
.gitlab-ci.yml
161
.gitlab-ci.yml
|
@ -1,161 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
# SPDX-FileCopyrightText: 2021 Oliver Rümpelein
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
image: node:lts
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
- prepare-release
|
||||
- release
|
||||
- publish
|
||||
|
||||
cache: &global_cache
|
||||
paths:
|
||||
- .yarn/cache
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
before_script:
|
||||
- yarn install --immutable
|
||||
script:
|
||||
- yarn lint
|
||||
cache:
|
||||
<<: *global_cache
|
||||
|
||||
reuse:
|
||||
stage: test
|
||||
image:
|
||||
name: fsfe/reuse:latest
|
||||
entrypoint: ['']
|
||||
script:
|
||||
- reuse lint
|
||||
|
||||
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
|
||||
|
||||
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]+$/'
|
||||
|
||||
.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 module.json
|
||||
git --no-pager diff
|
||||
git commit -m "chore(release): ${RELEASE_VERSION}"
|
||||
git tag -f ${RELEASE_VERSION}
|
||||
git push origin ci-processing:${CI_BUILD_REF_NAME} -o ci.skip
|
||||
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
|
||||
|
||||
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
|
||||
FVTT_DELETE_OBSOLETE_VERSIONS: 'true'
|
||||
script: foundry-publish
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
32
.woodpecker/checks.yml
Normal file
32
.woodpecker/checks.yml
Normal file
|
@ -0,0 +1,32 @@
|
|||
# SPDX-FileCopyrightText: 2023 Johannes Loher
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
variables:
|
||||
- &node_image node:lts
|
||||
|
||||
when:
|
||||
- event: push
|
||||
- event: tag
|
||||
- event: manual
|
||||
|
||||
steps:
|
||||
install:
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn install --immutable
|
||||
lint:
|
||||
group: test
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn lint
|
||||
reuse:
|
||||
group: test
|
||||
image: fsfe/reuse:latest
|
||||
commands:
|
||||
- reuse lint
|
||||
build:
|
||||
group: build
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn build
|
77
.woodpecker/publish.yml
Normal file
77
.woodpecker/publish.yml
Normal file
|
@ -0,0 +1,77 @@
|
|||
# SPDX-FileCopyrightText: 2023 Johannes Loher
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
variables:
|
||||
- &node_image node:lts
|
||||
|
||||
when:
|
||||
event: tag
|
||||
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
|
||||
|
||||
depends_on:
|
||||
- checks
|
||||
|
||||
steps:
|
||||
install:
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn install --immutable
|
||||
build:
|
||||
image: *node_image
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
commands:
|
||||
- yarn build
|
||||
publish-artifacts:
|
||||
group: prepare-release
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- apk update
|
||||
- apk add zip curl
|
||||
- mv dist ${CI_REPO_NAME}
|
||||
- zip -r ${CI_REPO_NAME}.zip ${CI_REPO_NAME}/*
|
||||
- CI_FORGE_API_URL=${CI_FORGE_URL}/api/v4
|
||||
- 'curl --fail --header "Authorization: Bearer $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}.zip "$${CI_FORGE_API_URL}/projects/${CI_REPO_REMOTE_ID}/packages/generic/${CI_REPO_NAME}/${CI_COMMIT_TAG}/${CI_REPO_NAME}.zip"'
|
||||
- 'curl --fail --header "Authorization: Bearer $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}/$${PACKAGE_TYPE}.json "$${CI_FORGE_API_URL}/projects/${CI_REPO_REMOTE_ID}/packages/generic/${CI_REPO_NAME}/${CI_COMMIT_TAG}/$${PACKAGE_TYPE}.json"'
|
||||
secrets:
|
||||
- forge_token
|
||||
- package_type
|
||||
changelog:
|
||||
group: prepare-release
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn changelog
|
||||
release:
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
commands:
|
||||
- CI_FORGE_API_URL=${CI_FORGE_URL}/api/v4
|
||||
- |
|
||||
release-cli \
|
||||
--server-url ${CI_FORGE_URL} \
|
||||
--private-token $${FORGE_TOKEN} \
|
||||
--project-id ${CI_REPO_REMOTE_ID} \
|
||||
create \
|
||||
--name ${CI_COMMIT_TAG} \
|
||||
--description CHANGELOG.md \
|
||||
--tag-name ${CI_COMMIT_TAG} \
|
||||
--assets-link "[\
|
||||
{\"name\": \"${CI_REPO_NAME}.zip\", \"url\": \"$${CI_FORGE_API_URL}/projects/${CI_REPO_REMOTE_ID}/packages/generic/${CI_REPO_NAME}/${CI_COMMIT_TAG}/${CI_REPO_NAME}.zip\", \"filepath\": \"/${CI_REPO_NAME}.zip\", \"link_type\": \"package\"},\
|
||||
{\"name\": \"$${PACKAGE_TYPE}.json\", \"url\": \"$${CI_FORGE_API_URL}/projects/${CI_REPO_REMOTE_ID}/packages/generic/${CI_REPO_NAME}/${CI_COMMIT_TAG}/$${PACKAGE_TYPE}.json\", \"filepath\": \"/$${PACKAGE_TYPE}.json\", \"link_type\": \"other\"}\
|
||||
]"
|
||||
secrets:
|
||||
- forge_token
|
||||
- package_type
|
||||
publish-to-foundry-admin:
|
||||
image: johannesloher/foundry-publish
|
||||
environment:
|
||||
FVTT_DELETE_OBSOLETE_VERSIONS: 'true'
|
||||
commands:
|
||||
- FVTT_MANIFEST_PATH=${CI_REPO_NAME}/$${PACKAGE_TYPE}.json
|
||||
- FVTT_MANIFEST_URL=${CI_REPO_URL}/-/releases/${CI_COMMIT_TAG}/downlaods/$${PACKAGE_TYPE}.json
|
||||
- foundry-publish
|
||||
secrets:
|
||||
- fvtt_package_id
|
||||
- fvtt_username
|
||||
- fvtt_password
|
||||
- package_type
|
39
.woodpecker/release.yml
Normal file
39
.woodpecker/release.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
# SPDX-FileCopyrightText: 2023 Johannes Loher
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
variables:
|
||||
- &node_image node:lts
|
||||
|
||||
when:
|
||||
event: manual
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
depends_on:
|
||||
- checks
|
||||
|
||||
steps:
|
||||
install:
|
||||
image: *node_image
|
||||
commands:
|
||||
- yarn install --immutable
|
||||
release:
|
||||
image: *node_image
|
||||
commands:
|
||||
- apt-get update
|
||||
- apt-get install --yes jq
|
||||
- REPOSITORY_URL=$(echo "${CI_REPO_CLONE_URL}" | sed -e "s|://|://$${FORGE_TOKEN_NAME}:$${FORGE_TOKEN}@|g")
|
||||
- git remote set-url origin $${REPOSITORY_URL}
|
||||
- git config user.name woodpecker[bot]
|
||||
- git config user.email woodpecker[bot]@${CI_SYSTEM_HOST}
|
||||
- yarn bump-version --release=${RELEASE_TYPE}
|
||||
- RELEASE_VERSION=$(jq -r '.version' < package.json)
|
||||
- git --no-pager diff
|
||||
- git add package.json module.json
|
||||
- 'git commit -m "chore(release): $${RELEASE_VERSION}"'
|
||||
- git tag -f $${RELEASE_VERSION}
|
||||
- git push origin ${CI_COMMIT_BRANCH}
|
||||
- git push origin $${RELEASE_VERSION}
|
||||
secrets:
|
||||
- forge_token_name
|
||||
- forge_token
|
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
],
|
||||
"url": "https://git.f3l.de/saluu/darkness-dependent-vision",
|
||||
"manifest": "https://git.f3l.de/api/v4/projects/saluu%2Fdarkness-dependent-vision/packages/generic/darkness-dependent-vision/latest/module.json",
|
||||
"manifest": "https://git.f3l.de/saluu/darkness-dependent-vision/-/releases/permalink/latest/downloads/module.json",
|
||||
"download": "https://git.f3l.de/saluu/darkness-dependent-vision/-/releases/0.3.10/downloads/darkness-dependent-vision.zip",
|
||||
"bugs": "https://git.f3l.de/saluu/darkness-dependent-vision/-/issues",
|
||||
"changelog": "https://git.f3l.de/saluu/darkness-dependent-vision/-/releases/0.3.10",
|
||||
|
|
|
@ -67,13 +67,13 @@ function bumpVersion(release) {
|
|||
|
||||
console.log(`Bumping version number to '${targetVersion}'`);
|
||||
packageJson.version = targetVersion;
|
||||
fs.writeJSONSync('package.json', packageJson, { spaces: 4 });
|
||||
fs.writeJSONSync('package.json', packageJson, { spaces: 2 });
|
||||
manifest.license = getLicenseURL(targetVersion);
|
||||
manifest.readme = getReadmeURL(targetVersion);
|
||||
manifest.changelog = getChangelogURL(targetVersion);
|
||||
manifest.version = targetVersion;
|
||||
manifest.download = getDownloadURL(targetVersion);
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
||||
}
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).usage('Usage: $0').option('release', {
|
||||
|
|
Loading…
Reference in a new issue