ci(release): API via GITHUB_SERVER_URL, download links via PUBLIC_HOST
Drop fragile STAGING_HOST/PROD_HOST host-detection. The runner's GITHUB_SERVER_URL reports the internal name (gitea.xenophon), which never matched the public-DNS vars. Now the API uses GITHUB_SERVER_URL directly (reliable from CI) and the release-body download links use a single per-instance PUBLIC_HOST var (gitea.scriptorium / repos.gmgauthier.com). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0ed00f6abb
commit
fa6fc62c3c
@ -78,31 +78,24 @@ jobs:
|
||||
shell: bash
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
STAGING_HOST: ${{ vars.STAGING_HOST }}
|
||||
PROD_HOST: ${{ vars.PROD_HOST }}
|
||||
# Public DNS name of this instance, used for the user-facing download
|
||||
# links in the release body. Set per instance, e.g.
|
||||
# staging: PUBLIC_HOST=gitea.scriptorium
|
||||
# prod: PUBLIC_HOST=repos.gmgauthier.com
|
||||
PUBLIC_HOST: ${{ vars.PUBLIC_HOST }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
# GITHUB_SERVER_URL is injected by Gitea and points at the instance
|
||||
# actually running this job. Strip scheme + any path to get the host.
|
||||
SERVER_HOST=${GITHUB_SERVER_URL#http://}
|
||||
SERVER_HOST=${SERVER_HOST#https://}
|
||||
SERVER_HOST=${SERVER_HOST%%/*}
|
||||
# API calls go to the instance the runner is already talking to
|
||||
# (GITHUB_SERVER_URL — correct scheme/host/port, reachable from CI).
|
||||
GITEA_API=${GITHUB_SERVER_URL%/}/api/v1
|
||||
|
||||
# Pick the configured host variable matching the running environment.
|
||||
case "$SERVER_HOST" in
|
||||
"$PROD_HOST") HOST="$PROD_HOST" ;;
|
||||
"$STAGING_HOST") HOST="$STAGING_HOST" ;;
|
||||
*)
|
||||
echo "ERROR: running on unrecognized host '${SERVER_HOST}'."
|
||||
echo "Expected STAGING_HOST='${STAGING_HOST}' or PROD_HOST='${PROD_HOST}'."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "Detected environment host: ${HOST}"
|
||||
# Public host for the download links baked into the release body.
|
||||
HOST=${PUBLIC_HOST:?PUBLIC_HOST variable is not set on this Gitea instance}
|
||||
echo "API base: ${GITEA_API}"
|
||||
echo "Public host for release links: ${HOST}"
|
||||
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
GITEA_API=https://${HOST}/api/v1
|
||||
REPO=${GITHUB_REPOSITORY}
|
||||
|
||||
echo "Creating release for tag ${VERSION} on ${REPO}..."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user