diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b8ffa8b..fa457410 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} + git push origin v${RELEASE_VERSION} only: - - master + - main when: manual release-patch: @@ -146,19 +152,20 @@ 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: + name: ${CI_COMMIT_TAG:1} 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 +175,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, diff --git a/tools/bump-version.js b/tools/bump-version.js index 8038837b..90e1db5e 100644 --- a/tools/bump-version.js +++ b/tools/bump-version.js @@ -12,8 +12,8 @@ const gitlabURL = "https://git.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 getDownloadURL = (version) => `${gitlabURL}/${repository}/-/releases/${version}/downloads/ds4.zip`; +const getChangelogURL = (version) => `${gitlabURL}/${repository}/-/releases/v${version}`; +const getDownloadURL = (version) => `${gitlabURL}/${repository}/-/releases/v${version}/downloads/system.zip`; const manifestPath = "./system.json";