ds4/.woodpecker/publish.yaml

115 lines
3.1 KiB
YAML
Raw Permalink Normal View History

2023-06-29 21:53:50 +02:00
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
$schema: https://raw.githubusercontent.com/woodpecker-ci/woodpecker/master/pipeline/schema/schema.json
variables:
2023-07-22 00:16:14 +02:00
- &node_image node:lts
- &enable_pnpm
- corepack enable
- corepack prepare pnpm@latest --activate
- &is_latest_channel
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
- &is_beta_channel
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+-[0-9]+$"
- &release_plugin woodpeckerci/plugin-gitea-release
- &release_base_settings
base_url: ${CI_FORGE_URL}
title: ${CI_COMMIT_TAG}
note: CHANGELOG.md
files:
- ${CI_REPO_NAME}.zip
- ${CI_REPO_NAME}/system.json
api_key:
from_secret: forge_token
2023-06-29 21:53:50 +02:00
when:
2023-07-22 00:16:14 +02:00
event: tag
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[0-9]+)?$"
2023-06-29 21:53:50 +02:00
depends_on:
2023-07-22 00:16:14 +02:00
- checks
2023-06-29 21:53:50 +02:00
steps:
2023-07-22 00:16:14 +02:00
install:
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm install --frozen-lockfile
build:
image: *node_image
environment:
NODE_ENV: production
commands:
- export APPDATA=$(pwd)
- <<: *enable_pnpm
- pnpm build
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}/*
changelog:
group: prepare-release
image: *node_image
commands:
- <<: *enable_pnpm
- pnpm changelog
choose-latest-channel:
group: prepare-release
image: alpine:latest
commands:
- echo latest > .RELEASE_CHANNEL
when:
<<: *is_latest_channel
2023-07-22 00:16:14 +02:00
choose-beta-channel:
group: prepare-release
image: alpine:latest
commands:
- echo beta > .RELEASE_CHANNEL
when:
<<: *is_beta_channel
release-latest:
image: *release_plugin
2023-07-22 00:16:14 +02:00
settings:
<<: *release_base_settings
when:
<<: *is_latest_channel
release-beta:
image: *release_plugin
settings:
<<: *release_base_settings
prerelease: true
when:
<<: *is_beta_channel
2023-07-22 00:16:14 +02:00
publish-manifest:
group: publish
image: alpine:latest
commands:
- apk update
- apk add curl
- export RELEASE_CHANNEL=$(cat .RELEASE_CHANNEL)
- 'curl --header "Authorization: token $${FORGE_TOKEN}" -X "DELETE" "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/$${RELEASE_CHANNEL}/system.json"'
- 'curl --fail --header "Authorization: token $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}/system.json "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/$${RELEASE_CHANNEL}/system.json"'
secrets:
- forge_token
publish-to-foundry-admin:
group: publish
image: johannesloher/foundry-publish
environment:
FVTT_DELETE_OBSOLETE_VERSIONS: "true"
commands:
- export FVTT_MANIFEST_PATH=${CI_REPO_NAME}/system.json
- export FVTT_MANIFEST_URL=${CI_REPO_URL}/releases/download/${CI_COMMIT_TAG}/system.json
- foundry-publish
secrets:
- fvtt_package_id
- fvtt_username
- fvtt_password
when:
<<: *is_latest_channel