From 08a066fe830192224fb985926013170d66bfadd9 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Mon, 23 May 2022 07:02:50 +0200 Subject: [PATCH] ci: use gitlab latest release link --- .gitlab-ci.yml | 50 ++++++++++++++++++++++++++++---------------------- README.md | 2 +- system.json | 2 +- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b8ffa8b..573a2a70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,11 @@ image: node:lts +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 @@ -63,12 +68,11 @@ build: - if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi script: - yarn build - - mv dist ds4 cache: <<: *global_cache artifacts: paths: - - ds4 + - dist expire_in: 1 week publish-artifacts: @@ -78,11 +82,13 @@ publish-artifacts: - apk update - apk add zip curl script: | - 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" + cd dist + zip -r ../system.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 =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' changelog: stage: prepare-release @@ -96,12 +102,12 @@ changelog: paths: - CHANGELOG.md rules: - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' .release-template: &release-template stage: release before_script: - - yarn install + - 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") @@ -115,14 +121,14 @@ changelog: script: | yarn bump-version --release=${RELEASE_TYPE} RELEASE_VERSION=$(jq -r '.version' < package.json) - git add package.json system.json + git add package.json $PACKAGE_TYPE.json git --no-pager diff git commit -m "chore(release): ${RELEASE_VERSION}" - git tag -f ${RELEASE_VERSION} + git tag -f v${RELEASE_VERSION} git push origin ci-processing:${CI_BUILD_REF_NAME} -o ci.skip git push origin ${RELEASE_VERSION} only: - - master + - main when: manual release-patch: @@ -146,19 +152,19 @@ release: script: - echo 'release job' rules: - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' release: tag_name: $CI_COMMIT_TAG description: "./CHANGELOG.md" assets: links: - - name: "ds4.zip" - url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/ds4.zip" - filepath: /ds4.zip + - name: "$PACKAGE_TYPE.zip" + url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.zip" + filepath: /$PACKAGE_TYPE.zip link_type: package - - name: "system.json" - url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json" - filepath: /system.json + - name: "$PACKAGE_TYPE.json" + url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.json" + filepath: /$PACKAGE_TYPE.json link_type: other publish-latest-manifest: @@ -168,17 +174,17 @@ publish-latest-manifest: - 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" + curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file dist/$PACKAGE_TYPE.json "$PACKAGE_REGISTRY_URL/latest/$PACKAGE_TYPE.json" rules: - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' publish-to-foundry-admin: stage: publish image: johannesloher/foundry-publish variables: - FVTT_MANIFEST_PATH: ds4/system.json + FVTT_MANIFEST_PATH: dist/$PACKAGE_TYPE.json FVTT_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/system.json FVTT_DELETE_OBSOLETE_VERSIONS: "true" script: foundry-publish rules: - - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' diff --git a/README.md b/README.md index 8c0e3939..e056d3e2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,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/api/v4/projects/dungeonslayers%2Fds4/packages/generic/ds4/latest/system.json +https://git.f3l.de/dungeonslayers/ds4/-/releases/permalink/latest/downloads/system.json ## Development diff --git a/system.json b/system.json index 4c7e6581..4e094081 100644 --- a/system.json +++ b/system.json @@ -100,7 +100,7 @@ "type": "Item" } ], - "manifest": "https://git.f3l.de/api/v4/projects/dungeonslayers%2Fds4/packages/generic/ds4/latest/system.json", + "manifest": "https://git.f3l.de/dungeonslayers/ds4/-/releases/permalink/latest/downloads/system.json", "download": "https://git.f3l.de/dungeonslayers/ds4/-/releases/1.14.0/downloads/ds4.zip", "initiative": "@combatValues.initiative.total", "gridDistance": 1,