ci: switch to woodpecker #97

Merged
saluu merged 1 commit from woodpecker into main 2023-06-30 00:30:20 +02:00
14 changed files with 350 additions and 279 deletions

View file

@ -0,0 +1,99 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
name: Bug Report
about: File a bug report
labels: ["bug", "to be confirmed"]
body:
- type: markdown
attributes:
value: |
Your issue may already have been reported! Please search on the [issue tracker](https://git.f3l.de/dungeonslayers/ds4/issues) before submitting a new one.
Thanks for taking the time to fill out this bug report! In order to make it effective, please provide the following information.
- type: markdown
attributes:
value: |
## Issue Description
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What is the behavior that you expected?
validations:
required: true
- type: textarea
id: current
attributes:
label: Current Behavior
description: What is the current behavior, i.e., what happens actually?
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce
description: What are the steps to reproduce the problem?
placeholder: |
1.
2.
3.
4.
validations:
required: true
- type: textarea
id: context
attributes:
label: Context
description: Please provide any additional context that might be helpful, e.g. log messages, screenshots, videos, or exports of problematic scenes or worlds.
validations:
required: false
- type: markdown
attributes:
value: |
## Environment Details
- type: input
id: version
attributes:
label: Version
description: Which version(s) of DS4 are you seeing the problem on?
validations:
required: true
- type: input
id: foundry-version
attributes:
label: Foundry VTT Version
description: Which version(s) and build of Foundry VTT are you seeing the problem on?
validations:
required: true
- type: input
id: os
attributes:
label: Operating System
description: Which operating system are you using? (Windows, OS X, Linux (which distro))
placeholder: Windows
validations:
required: true
- type: dropdown
id: browser
attributes:
label: Browser / App
description: Are you using a Browser or the native Electron application? (Select all that apply)
multiple: true
options:
- Native Electron App
- Chrome
- Firefox
- Microsoft Edge
- Safari
- Other
validations:
required: true
- type: input
id: modules
attributes:
label: Relevant Modules
description: Please list any other active modules (including their versions) that you think might be relevant.
validations:
required: false

View file

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
blank_issues_enabled: false

View file

@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
name: Feature Request
description: Submit a feature request
labels: ["feature"]
body:
- type: markdown
attributes:
value: |
Your issue may already have been reported! Please search on the [issue tracker](https://git.f3l.de/dungeonslayers/ds4/issues) before submitting a new one.
In order to submit an effective feature request, please provide the following information.
- type: textarea
id: description
attributes:
label: Description
description: Please describe the proposal in as much detail as you feel is necessary.
validations:
required: true
- type: textarea
id: context
attributes:
label: Context
description: Is there anything else you can add about the proposal? You might want to link to related issues here if you haven't already.
validations:
required: false

View file

@ -1,197 +0,0 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
# SPDX-FileCopyrightText: 2021 Oliver Rümpelein
#
# SPDX-License-Identifier: MIT
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_TAG
variables:
PACKAGE_NAME: ds4
PACKAGE_TYPE: system
PACKAGE_REGISTRY_URL: $CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME
stages:
- check
- build
- prepare-release
- release
- publish
image: node:lts
cache: &global_cache
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
.pnpm_install: &pnpm_install
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm config set store-dir .pnpm-store
- pnpm install --frozen-lockfile
.pnpm_job: &pnpm_job
before_script:
- *pnpm_install
cache:
<<: *global_cache
lint:
stage: check
<<: *pnpm_job
script:
- pnpm lint
typecheck:
stage: check
<<: *pnpm_job
script:
- pnpm typecheck
test:
stage: check
<<: *pnpm_job
script:
- pnpm test:ci
artifacts:
when: always
reports:
junit:
- junit.xml
reuse:
stage: check
image:
name: fsfe/reuse:latest
entrypoint: [""]
script:
- reuse lint
commitlint:
stage: check
<<: *pnpm_job
script:
- pnpm exec commitlint --from $CI_MERGE_REQUEST_DIFF_BASE_SHA
rules:
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_DIFF_BASE_SHA"
build:
stage: build
<<: *pnpm_job
before_script:
- *pnpm_install
- if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi
script:
- pnpm build
artifacts:
paths:
- dist
expire_in: 1 week
publish-artifacts:
stage: prepare-release
image: alpine:latest
before_script:
- apk update
- apk add zip curl
script: |
cd dist
zip -r ../$PACKAGE_TYPE.zip .
cd ..
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $PACKAGE_TYPE.zip "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.zip"
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file dist/$PACKAGE_TYPE.json "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.json"
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
changelog:
stage: prepare-release
<<: *pnpm_job
script:
- pnpm changelog
artifacts:
paths:
- CHANGELOG.md
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
.release-template: &release-template
stage: release
<<: *pnpm_job
before_script:
- *pnpm_install
- 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
script: |
pnpm bump-version --release=${RELEASE_TYPE}
RELEASE_VERSION=$(jq -r '.version' < package.json)
git add package.json $PACKAGE_TYPE.json
git --no-pager diff
git commit -m "chore(release): ${RELEASE_VERSION}"
git tag -f v${RELEASE_VERSION}
git push origin ci-processing:${CI_BUILD_REF_NAME} -o ci.skip
git push origin v${RELEASE_VERSION}
only:
- main
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 =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
release:
name: ${CI_COMMIT_TAG:1}
tag_name: $CI_COMMIT_TAG
description: "./CHANGELOG.md"
assets:
links:
- name: "$PACKAGE_TYPE.zip"
url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.zip"
filepath: /$PACKAGE_TYPE.zip
link_type: package
- name: "$PACKAGE_TYPE.json"
url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.json"
filepath: /$PACKAGE_TYPE.json
link_type: other
publish-to-foundry-admin:
stage: publish
image: johannesloher/foundry-publish
variables:
FVTT_MANIFEST_PATH: dist/$PACKAGE_TYPE.json
FVTT_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/$PACKAGE_TYPE.json
FVTT_DELETE_OBSOLETE_VERSIONS: "true"
script: foundry-publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'

View file

@ -1,48 +0,0 @@
Your issue may already have been reported! Please search on the issue tracker (https://git.f3l.de/dungeonslayers/ds4/-/issues) before submitting a new one.
Thanks for taking the time to fill out this bug report! In order to make it effective, please provide the following information.
# Issue Description
## Expected Behavior
(What is the behavior that you expected?)
## Current Behavior
(What is the current behavior, i.e., what happens actually?)
## Steps to Reproduce
(What are the steps to reproduce the problem?)
1. ...
2. ...
3. ...
## Context
(Please provide any additional context that might be helpful, e.g. log messages,
screenshots, videos, or exports of problematic scenes or worlds.)
# Environment Details
## Version
(Which version(s) of DS4 are you seeing the problem on?)
## Foundry VTT Version
(Which version(s) and build of Foundry VTT are you seeing the problem on?)
## Operating System
(Which operating system are you using? (Windows, OS X, Linux (which distro)))
## Browser / App
(Are you using a Browser or the native Electron application?)
## Relevant Modules
(Please list any active modules (including their versions) that you think might be relevant.)

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2022 Johannes Loher
SPDX-License-Identifier: MIT

View file

@ -1,11 +0,0 @@
Your issue may already have been reported! Please search on the issue tracker (https://git.f3l.de/dungeonslayers/ds4/-/issues) before submitting a new one.
In order to submit an effective feature request, please provide the following information.
# Description
(Please describe the proposal in as much detail as you feel is necessary.)
# Context
(Is there anything else you can add about the proposal? You might want to link to related issues here if you haven't already.)

View file

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2022 Johannes Loher
SPDX-License-Identifier: MIT

63
.woodpecker/checks.yaml Normal file
View file

@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
$schema: https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/pipeline/schema/schema.json
variables:
- &node_image node:lts
- &enable_pnpm
- corepack enable
- corepack prepare pnpm@latest --activate
when:
- event: push
branch: ${CI_REPO_DEFAULT_BRANCH}
- event: pull_request
- event: tag
- event: manual
steps:
install:
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm install --frozen-lockfile
lint:
group: check
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm lint
typecheck:
group: check
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm typecheck
test:
group: check
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm test
reuse:
group: check
image: fsfe/reuse:latest
commands:
- reuse lint
commitlint:
group: check
image: *node_image
commands:
- <<: *enable_pnpm
- git fetch
- pnpm exec commitlint --from origin/${CI_COMMIT_TARGET_BRANCH}
when:
event: pull_request
build:
group: build
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm build

80
.woodpecker/publish.yaml Normal file
View file

@ -0,0 +1,80 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
$schema: https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/pipeline/schema/schema.json
variables:
- &node_image node:lts
- &enable_pnpm
- corepack enable
- corepack prepare pnpm@latest --activate
when:
event: tag
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
depends_on:
- checks
steps:
install:
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm install --frozen-lockfile
build:
image: *node_image
environment:
NODE_ENV: production
commands:
- <<: *enable_pnpm
- pnpm build
package:
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}/*
changelog:
group: prepare-release
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm changelog
release:
image: woodpeckerci/plugin-gitea-release
settings:
base_url: ${CI_FORGE_URL}
title: ${CI_COMMIT_TAG}
note: CHANGELOG.md
files:
- ${CI_REPO_NAME}.zip
- ${CI_REPO_NAME}/system.json
api_key:
from_secret: forge_token
publish-latest-manifest:
group: publish
image: alpine:latest
commands:
- apk update
- apk add curl
- 'curl --header "Authorization: token $${FORGE_TOKEN}" -X "DELETE" "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/latest/system.json"'
- 'curl --fail --header "Authorization: token $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}/system.json "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/latest/system.json"'
secrets:
- forge_token
publish-to-foundry-admin:
group: publish
image: johannesloher/foundry-publish
environment:
FVTT_DELETE_OBSOLETE_VERSIONS: "true"
commands:
- export FVTT_MANIFEST_PATH=${CI_REPO_NAME}/system.json
- export FVTT_MANIFEST_URL=${CI_REPO_URL}/releases/download/${CI_COMMIT_TAG}/system.json
- foundry-publish
secrets:
- fvtt_package_id
- fvtt_username
- fvtt_password

46
.woodpecker/release.yaml Normal file
View file

@ -0,0 +1,46 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
$schema: https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/pipeline/schema/schema.json
variables:
- &node_image node:lts
- &enable_pnpm
- corepack enable
- corepack prepare pnpm@latest --activate
when:
event: manual
branch: ${CI_REPO_DEFAULT_BRANCH}
depends_on:
- checks
steps:
install:
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm install --frozen-lockfile
release:
image: *node_image
commands:
- <<: *enable_pnpm
- apt-get update
- apt-get install --yes jq
- export 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}
- pnpm bump-version --release=${RELEASE_TYPE}
- export RELEASE_VERSION=$(jq -r '.version' < package.json)
- git --no-pager diff
- git add package.json system.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

View file

@ -7,6 +7,13 @@ SPDX-License-Identifier: MIT
# DS4
[![status-badge](https://ci.f3l.de/api/badges/5/status.svg)](https://ci.f3l.de/repos/5)
[![REUSE status](https://api.reuse.software/badge/git.f3l.de/dungeonslayers/ds4)](https://api.reuse.software/info/git.f3l.de/dungeonslayers/ds4)
[![Forge installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fds4&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=ds4)
[![Supported foundry versions](https://img.shields.io/endpoint?url=https://foundryshields.com/version?url=https%3A%2F%2Fgit.f3l.de%2Fapi%2Fpackages%2Fdungeonslayers%2Fgeneric%2Fds4%2Flatest%2Fsystem.json)](https://git.f3l.de/dungeonslayers/ds4)
[![Matrix](https://img.shields.io/matrix/ds4%3Aim.f3l.de?server_fqdn=im.f3l.de&logo=matrix&color=0DBD8B)](https://matrix.to/#/#ds4:im.f3l.de)
[![Ko-fi](https://img.shields.io/badge/Ko--fi-ghostfvtt-00B9FE?logo=kofi)](https://ko-fi.com/ghostfvtt)
An implementation of the [Dungeonslayers] 4 game system for [Foundry Virtual
Tabletop].
@ -19,7 +26,7 @@ To install and use the Dungeonslayers 4 system for Foundry Virtual Tabletop,
find it in the list in the **Install System** dialog on the Setup menu of the
application. Alternatively, paste the following Manifest URL in that dialog:
https://git.f3l.de/dungeonslayers/ds4/-/releases/permalink/latest/downloads/system.json
https://git.f3l.de/api/packages/dungeonslayers/generic/ds4/latest/system.json
## Development
@ -89,11 +96,9 @@ pnpm test
## Contributing
Code and content contributions are accepted. Please feel free to submit issues
to the issue tracker or submit merge requests for code changes. To create an
issue, send a mail to [git+dungeonslayers-ds4-155-issue-@git.f3l.de].
Code and content contributions are accepted. To report issues, please contact us in [Matrix](https://matrix.to/#/#ds4:im.f3l.de).
## Licensing
https://matrix.to/#/#ds4:im.f3l.de## Licensing
This project is being developed under the terms of the
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT] for Foundry Virtual Tabletop.
@ -107,7 +112,6 @@ author(s). You can find these attributions in [ATTRIBUTION.md](ATTRIBUTION.md).
[Dungeonslayers]: https://www.dungeonslayers.net/
[Foundry Virtual Tabletop]: http://foundryvtt.com/
[git+dungeonslayers-ds4-155-issue-@git.f3l.de]: mailto:git+dungeonslayers-ds4-155-issue-@git.f3l.de
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT]: https://foundryvtt.com/article/license/
[REUSE]: https://reuse.software/
[.reuse/dep5]: .reuse/dep5

View file

@ -10,7 +10,7 @@
"url": "https://git.f3l.de/dungeonslayers/ds4"
},
"bugs": {
"url": "https://git.f3l.de/dungeonslayers/ds4/-/issues"
"url": "https://git.f3l.de/dungeonslayers/ds4/issues"
},
"contributors": [
{

View file

@ -7,15 +7,20 @@ import semver from "semver";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
const repository = "dungeonslayers/ds4";
const gitlabURL = "https://git.f3l.de";
const packageType = "system";
const repositoryOwner = process.env.CI_REPO_OWNER;
const repositoryName = process.env.CI_REPO_NAME;
const repositoryURL = process.env.CI_REPO_LINK;
const forgeURL = process.env.CI_FORGE_URL;
const getLicenseURL = (version) => `${gitlabURL}/${repository}/-/raw/${version}/LICENSE.md`;
const getReadmeURL = (version) => `${gitlabURL}/${repository}/-/raw/${version}/README.md`;
const getChangelogURL = (version) => `${gitlabURL}/${repository}/-/releases/v${version}`;
const getDownloadURL = (version) => `${gitlabURL}/${repository}/-/releases/v${version}/downloads/system.zip`;
const manifestURL = `${forgeURL}/api/packages/${repositoryOwner}/generic/${repositoryName}/latest/${packageType}.json`;
const getDownloadURL = (version) => `${repositoryURL}/releases/download/${version}/${repositoryName}.zip`;
const bugsURL = `${repositoryURL}/issues`;
const getChangelogURL = (version) => `${repositoryURL}/releases/tag/${version}`;
const getReadmeURL = (version) => `${repositoryURL}/raw/tag/${version}/README.md`;
const getLicenseURL = (version) => `${repositoryURL}/raw/tag/${version}/LICENSE.md`;
const manifestPath = "./system.json";
const manifestPath = `${packageType}.json`;
/**
* Get the contents of the manifest file as object.
@ -67,11 +72,14 @@ function bumpVersion(release) {
console.log(`Bumping version number to '${targetVersion}'`);
packageJson.version = targetVersion;
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
manifest.license = getLicenseURL(targetVersion);
manifest.readme = getReadmeURL(targetVersion);
manifest.changelog = getChangelogURL(targetVersion);
manifest.version = targetVersion;
manifest.url = repositoryURL;
manifest.manifest = manifestURL;
manifest.download = getDownloadURL(targetVersion);
manifest.bugs = bugsURL;
manifest.changelog = getChangelogURL(targetVersion);
manifest.readme = getReadmeURL(targetVersion);
manifest.license = getLicenseURL(targetVersion);
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
}