From 97a521906c2238bc36fa91972e0c0f0ff50470ae 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 --- .woodpecker/publish.yml | 50 +++++++++++++++++++---------------------- module.json | 14 ++++++------ tools/bump-version.mjs | 10 ++++----- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/.woodpecker/publish.yml b/.woodpecker/publish.yml index b60f8f1..ac86f02 100644 --- a/.woodpecker/publish.yml +++ b/.woodpecker/publish.yml @@ -23,55 +23,51 @@ 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 + - export CI_FORGE_API_URL=${CI_FORGE_URL}/api + - 'curl --header "Authorization: token $${FORGE_TOKEN}" -X "DELETE" "$${CI_FORGE_API_URL}/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_API_URL}/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}/releasesdownload/${CI_COMMIT_TAG}/module.json - foundry-publish secrets: - fvtt_package_id - fvtt_username - fvtt_password - - package_type diff --git a/module.json b/module.json index 43ba923..c3ed3a0 100644 --- a/module.json +++ b/module.json @@ -31,11 +31,11 @@ "path": "lang/en.json" } ], - "url": "https://git.f3l.de/saluu/darkness-dependent-vision", - "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.12/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.12", - "readme": "https://git.f3l.de/saluu/darkness-dependent-vision/-/raw/0.3.12/README.md", - "license": "https://git.f3l.de/saluu/darkness-dependent-vision/-/raw/0.3.12/LICENSE.md" + "url": "https://git2.f3l.de/saluu/darkness-dependent-vision", + "manifest": "https://git2.f3l.de/api/packages/saluu/generic/darkness-dependent-vision/latest/module.json", + "download": "https://git2.f3l.de/saluu/darkness-dependent-vision/releases/download/0.3.12/downloads/darkness-dependent-vision.zip", + "bugs": "https://git2.f3l.de/saluu/darkness-dependent-vision/issues", + "changelog": "https://git2.f3l.de/saluu/darkness-dependent-vision/releases/tag/0.3.12", + "readme": "https://git2.f3l.de/saluu/darkness-dependent-vision/raw/tag/0.3.12/README.md", + "license": "https://git2.f3l.de/saluu/darkness-dependent-vision/raw/tag/0.3.12/LICENSE.md" } diff --git a/tools/bump-version.mjs b/tools/bump-version.mjs index 63d2385..e8cf368 100644 --- a/tools/bump-version.mjs +++ b/tools/bump-version.mjs @@ -8,13 +8,13 @@ import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; const repository = 'saluu/darkness-dependent-vision'; -const gitlabURL = 'https://git.f3l.de'; +const giteaURL = 'https://git2.f3l.de'; -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 getLicenseURL = (version) => `${giteaURL}/${repository}/raw/tag/${version}/LICENSE.md`; +const getReadmeURL = (version) => `${giteaURL}/${repository}/raw/tag/${version}/README.md`; +const getChangelogURL = (version) => `${giteaURL}/${repository}/releases/tag/${version}`; const getDownloadURL = (version) => - `${gitlabURL}/${repository}/-/releases/${version}/downloads/darkness-dependent-vision.zip`; + `${giteaURL}/${repository}/releases/download/${version}/darkness-dependent-vision.zip`; const manifestPath = 'module.json';