From f36c7f52b75f940e797649fbb170a58acb0bcb98 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Fri, 17 Sep 2021 19:46:36 +0200 Subject: [PATCH] ci: publish to foundry automatically --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++---- gulpfile.js | 2 ++ src/system.json | 1 + 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f99b0e6..098724d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,9 @@ image: node:lts stages: - test - build - - publish + - prepare-release - release + - publish cache: &global_cache paths: @@ -61,8 +62,8 @@ build: expire_in: 1 week publish-artifacts: + stage: prepare-release image: alpine:latest - stage: publish before_script: - apk update - apk add zip curl @@ -70,12 +71,11 @@ publish-artifacts: zip -r ds4.zip ds4/* curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/ds4.zip" curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4/system.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json" - curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4/system.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/latest/system.json" rules: - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' changelog: - stage: publish + stage: prepare-release before_script: - yarn install --immutable script: @@ -150,3 +150,24 @@ release: url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json" filepath: /system.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 ds4/system.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/latest/system.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: ./src/system.json + FVTT_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/system.json + script: foundry-publish + rules: + - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' diff --git a/gulpfile.js b/gulpfile.js index 192a85c2..89943005 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,6 +24,7 @@ const stylesExtension = ".scss"; const sourceFileExtension = ".ts"; const staticFiles = ["assets", "fonts", "lang", "packs", "templates", "system.json", "template.json"]; const getDownloadURL = (version) => `https://git.f3l.de/dungeonslayers/ds4/-/releases/${version}/downloads/ds4.zip`; +const getChangelogURL = (version) => `https://git.f3l.de/dungeonslayers/ds4/-/releases/${version}`; /********************/ /* BUILD */ @@ -210,6 +211,7 @@ function bumpVersion(cb) { manifest.file.version = targetVersion; manifest.file.download = getDownloadURL(targetVersion); + manifest.file.changelog = getChangelogURL(targetVersion); fs.writeJSONSync(path.join(sourceDirectory, manifest.name), manifest.file, { spaces: 4 }); return cb(); diff --git a/src/system.json b/src/system.json index 319c702e..5e86a6ad 100644 --- a/src/system.json +++ b/src/system.json @@ -93,6 +93,7 @@ "url": "https://git.f3l.de/dungeonslayers/ds4", "manifest": "https://git.f3l.de/api/v4/projects/dungeonslayers%2Fds4/packages/generic/ds4/latest/system.json", "download": "https://git.f3l.de/dungeonslayers/ds4/-/releases/1.4.3/downloads/ds4.zip", + "changelog": "https://git.f3l.de/dungeonslayers/ds4/-/releases/1.4.3", "license": "https://git.f3l.de/dungeonslayers/ds4#licensing", "initiative": "@combatValues.initiative.total", "manifestPlusVersion": "1.0.0",