ci: use gitlab latest release link

This commit is contained in:
Johannes Loher 2022-05-23 07:02:50 +02:00
parent 64e17360b3
commit 08a066fe83
3 changed files with 30 additions and 24 deletions

View file

@ -5,6 +5,11 @@
image: node:lts 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: stages:
- check - check
- build - build
@ -63,12 +68,11 @@ build:
- if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi - if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi
script: script:
- yarn build - yarn build
- mv dist ds4
cache: cache:
<<: *global_cache <<: *global_cache
artifacts: artifacts:
paths: paths:
- ds4 - dist
expire_in: 1 week expire_in: 1 week
publish-artifacts: publish-artifacts:
@ -78,11 +82,13 @@ publish-artifacts:
- apk update - apk update
- apk add zip curl - apk add zip curl
script: | script: |
zip -r ds4.zip ds4/* cd dist
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" zip -r ../system.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 ..
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: rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
changelog: changelog:
stage: prepare-release stage: prepare-release
@ -96,12 +102,12 @@ changelog:
paths: paths:
- CHANGELOG.md - CHANGELOG.md
rules: 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 .release-template: &release-template
stage: release stage: release
before_script: before_script:
- yarn install - yarn install --immutable
- apt update - apt update
- apt install --yes jq - apt install --yes jq
- REPOSITORY_URL=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|gitlab-ci-token:.*@|${RELEASE_TOKEN}:${RELEASE_TOKEN_SECRET}@|g") - REPOSITORY_URL=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|gitlab-ci-token:.*@|${RELEASE_TOKEN}:${RELEASE_TOKEN_SECRET}@|g")
@ -115,14 +121,14 @@ changelog:
script: | script: |
yarn bump-version --release=${RELEASE_TYPE} yarn bump-version --release=${RELEASE_TYPE}
RELEASE_VERSION=$(jq -r '.version' < package.json) 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 --no-pager diff
git commit -m "chore(release): ${RELEASE_VERSION}" 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 ci-processing:${CI_BUILD_REF_NAME} -o ci.skip
git push origin ${RELEASE_VERSION} git push origin ${RELEASE_VERSION}
only: only:
- master - main
when: manual when: manual
release-patch: release-patch:
@ -146,19 +152,19 @@ release:
script: script:
- echo 'release job' - echo 'release job'
rules: rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
release: release:
tag_name: $CI_COMMIT_TAG tag_name: $CI_COMMIT_TAG
description: "./CHANGELOG.md" description: "./CHANGELOG.md"
assets: assets:
links: links:
- name: "ds4.zip" - name: "$PACKAGE_TYPE.zip"
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/ds4.zip" url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.zip"
filepath: /ds4.zip filepath: /$PACKAGE_TYPE.zip
link_type: package link_type: package
- name: "system.json" - name: "$PACKAGE_TYPE.json"
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json" url: "$PACKAGE_REGISTRY_URL/$CI_COMMIT_TAG/$PACKAGE_TYPE.json"
filepath: /system.json filepath: /$PACKAGE_TYPE.json
link_type: other link_type: other
publish-latest-manifest: publish-latest-manifest:
@ -168,17 +174,17 @@ publish-latest-manifest:
- apk update - apk update
- apk add zip curl - apk add zip curl
script: | 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: 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: publish-to-foundry-admin:
stage: publish stage: publish
image: johannesloher/foundry-publish image: johannesloher/foundry-publish
variables: 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_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/system.json
FVTT_DELETE_OBSOLETE_VERSIONS: "true" FVTT_DELETE_OBSOLETE_VERSIONS: "true"
script: foundry-publish script: foundry-publish
rules: rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'

View file

@ -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 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: 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 ## Development

View file

@ -100,7 +100,7 @@
"type": "Item" "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", "download": "https://git.f3l.de/dungeonslayers/ds4/-/releases/1.14.0/downloads/ds4.zip",
"initiative": "@combatValues.initiative.total", "initiative": "@combatValues.initiative.total",
"gridDistance": 1, "gridDistance": 1,