A composite action: reads the release from the event file with jq, looks up the repo's Announcements category (release-map.json) and posts as release-bot. One topic per repo+tag via the topic external_id, so a re-run is a no-op. Optional Discord webhook.
38 lines
1.4 KiB
YAML
38 lines
1.4 KiB
YAML
name: discourse-release
|
|
description: >-
|
|
Announce a published Gitea release on the Coffey Labs community forum, in the
|
|
repo's Announcements category (release-map.json). Safe to re-run: a release
|
|
is announced at most once.
|
|
inputs:
|
|
api-key:
|
|
description: release-bot's forum API key (scope topics:write only)
|
|
required: true
|
|
discord-webhook:
|
|
description: optional Discord webhook URL; when set, the announcement is also posted there
|
|
required: false
|
|
default: ""
|
|
forum:
|
|
description: forum base URL
|
|
required: false
|
|
default: https://community.coffeylabs.org
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- shell: sh
|
|
env:
|
|
API_KEY: ${{ inputs.api-key }}
|
|
DISCORD_WEBHOOK: ${{ inputs.discord-webhook }}
|
|
FORUM: ${{ inputs.forum }}
|
|
REPO: ${{ github.repository }}
|
|
EVENT_PATH: ${{ github.event_path }}
|
|
ACTION_PATH: ${{ github.action_path }}
|
|
MAP: ${{ github.action_path }}/release-map.json
|
|
run: |
|
|
set -eu
|
|
# The job image may be bare; the script needs bash, curl and jq.
|
|
if ! command -v curl >/dev/null || ! command -v jq >/dev/null || ! command -v bash >/dev/null; then
|
|
if command -v apk >/dev/null; then apk add --no-cache -q bash curl jq ca-certificates >/dev/null
|
|
else apt-get update -qq >/dev/null && apt-get install -y -qq --no-install-recommends bash curl jq ca-certificates >/dev/null; fi
|
|
fi
|
|
exec bash "$ACTION_PATH/announce.sh"
|