Files
actions/discourse-release/action.yml
T
jcoffey-dev 1f0c7971d6 discourse-release: announce a given tag, for releases made by the job's own token
Gitea starts no workflow for events caused by the Actions bot, so a release
created with GITHUB_TOKEN never fires 'on: release'. With 'tag:' the action
fetches that release itself; drafts are skipped.
2026-09-26 19:26:53 -07:00

48 lines
1.9 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: ""
tag:
description: >-
announce the release with this tag instead of the triggering release
event. Needed in a workflow that creates its release with the job's own
token: Gitea does not start workflows for events the Actions bot causes,
so `on: release` never fires for those releases.
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 }}
TAG: ${{ inputs.tag }}
GITEA_TOKEN: ${{ github.token }}
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"