From d1805811b65b6483df6d3487bbe3ecf7a52a6f69 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Wed, 21 Jun 2023 20:15:19 +0200 Subject: [PATCH] ci: switch to Gitea --- .reuse/dep5 | 2 +- .woodpecker/publish.yml | 49 ++++++++++++++++++----------------------- README.md | 8 ++++++- package.json | 8 +++---- tools/bump-version.mjs | 29 +++++++++++++++--------- 5 files changed, 52 insertions(+), 44 deletions(-) diff --git a/.reuse/dep5 b/.reuse/dep5 index 78c656e..e0edada 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -1,7 +1,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: darkness-dependent-vision Upstream-Contact: Johannes Loher -Source: https://git.f3l.de/saluu/darkness-dependent-vision +Source: https://git2.f3l.de/saluu/darkness-dependent-vision Files: .yarn/** Copyright: Copyright (c) 2016-present, Yarn Contributors. All rights reserved. diff --git a/.woodpecker/publish.yml b/.woodpecker/publish.yml index b60f8f1..9a72314 100644 --- a/.woodpecker/publish.yml +++ b/.woodpecker/publish.yml @@ -23,55 +23,50 @@ steps: NODE_ENV: production commands: - yarn build - - mv dist ${CI_REPO_NAME} - publish-artifacts: + 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}/* - - export 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 + 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}/module.json + api_key: + from_secret: forge_token + publish-latest-manifest: + group: publish + image: alpine:latest commands: - - export 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\"}\ - ]" + - 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/module.json"' + - 'curl --fail --header "Authorization: token $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}/module.json "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/latest/module.json"' secrets: - forge_token - - package_type publish-to-foundry-admin: + group: publish image: johannesloher/foundry-publish environment: FVTT_DELETE_OBSOLETE_VERSIONS: 'true' commands: - - export FVTT_MANIFEST_PATH=${CI_REPO_NAME}/$${PACKAGE_TYPE}.json - - export FVTT_MANIFEST_URL=${CI_REPO_URL}/-/releases/${CI_COMMIT_TAG}/downlaods/$${PACKAGE_TYPE}.json + - export FVTT_MANIFEST_PATH=${CI_REPO_NAME}/module.json + - export FVTT_MANIFEST_URL=${CI_REPO_URL}/releases/download/${CI_COMMIT_TAG}/module.json - foundry-publish secrets: - fvtt_package_id - fvtt_username - fvtt_password - - package_type diff --git a/README.md b/README.md index c9c97ec..c767972 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ SPDX-License-Identifier: MIT # Darkness Dependent Vision +[![status-badge](https://ci.f3l.de/api/badges/1/status.svg)](https://ci.f3l.de/repos/1) +[![REUSE status](https://api.reuse.software/badge/git2.f3l.de/saluu/darkness-dependent-vision)](https://api.reuse.software/info/git2.f3l.de/saluu/darkness-dependent-vision) +[![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%2Fdarkness-dependent-vision&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=darkness-dependent-vision) +[![Supported foundry versions](https://img.shields.io/endpoint?url=https://foundryshields.com/version?url=https%3A%2F%2Fgit2.f3l.de%2Fapi%2Fpackages%2Fsaluu%2Fgeneric%2Fdarkness-dependent-vision%2Flatest%2Fmodule.json)](https://git2.f3l.de/saluu/darkness-dependent-vision) +[![Ko-fi](https://img.shields.io/badge/Ko--fi-ghostfvtt-00B9FE?logo=kofi)](https://ko-fi.com/ghostfvtt) + A module for [Foundry Virtual Tabletop] that provides functionality to make the dim and bright vision of tokens depend on the scene's darkness level. @@ -15,7 +21,7 @@ To install and use the Darkness Dependent Vision module for Foundry Virtual Tabletop, simply paste the following URL into the **Install Module** dialog on the Setup menu of the application. -https://git.f3l.de/saluu/darkness-dependent-vision/-/raw/latest/src/module.json?inline=false +https://git2.f3l.de/api/packages/saluu/generic/darkness-dependent-vision/latest/module.json ### libWrapper diff --git a/package.json b/package.json index bdd76d6..4ae521a 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,14 @@ "name": "darkness-dependent-vision", "version": "0.3.12", "description": "A module for Foundry Virtual Tabletop that provides functionality to make the dim and bright vision of tokens depend on the scene's darkness level.", - "license": "https://git.f3l.de/saluu/darkness-dependent-vision#licensing", - "homepage": "https://git.f3l.de/saluu/darkness-dependent-vision", + "license": "https://git2.f3l.de/saluu/darkness-dependent-vision/src/branch/master/LICENSE.md", + "homepage": "https://git2.f3l.de/saluu/darkness-dependent-vision", "repository": { "type": "git", - "url": "https://git.f3l.de/saluu/darkness-dependent-vision" + "url": "https://git2.f3l.de/saluu/darkness-dependent-vision" }, "bugs": { - "url": "https://git.f3l.de/saluu/darkness-dependent-vision/-/issues" + "url": "https://git2.f3l.de/saluu/darkness-dependent-vision/issues" }, "contributors": [ { diff --git a/tools/bump-version.mjs b/tools/bump-version.mjs index 63d2385..d048d3c 100644 --- a/tools/bump-version.mjs +++ b/tools/bump-version.mjs @@ -7,16 +7,20 @@ import semver from 'semver'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; -const repository = 'saluu/darkness-dependent-vision'; -const gitlabURL = 'https://git.f3l.de'; +const packageType = 'module'; +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/${version}`; -const getDownloadURL = (version) => - `${gitlabURL}/${repository}/-/releases/${version}/downloads/darkness-dependent-vision.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 = 'module.json'; +const manifestPath = `${packageType}.json`; /** * Get the contents of the manifest file as object. @@ -68,11 +72,14 @@ function bumpVersion(release) { console.log(`Bumping version number to '${targetVersion}'`); packageJson.version = targetVersion; fs.writeJSONSync('package.json', packageJson, { spaces: 2 }); - 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: 2 }); }