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
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
STAGING_HOST: ${{ vars.STAGING_HOST }}
|
# Public DNS name of this instance, used for the user-facing download
|
||||||
PROD_HOST: ${{ vars.PROD_HOST }}
|
# 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: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# GITHUB_SERVER_URL is injected by Gitea and points at the instance
|
# API calls go to the instance the runner is already talking to
|
||||||
# actually running this job. Strip scheme + any path to get the host.
|
# (GITHUB_SERVER_URL — correct scheme/host/port, reachable from CI).
|
||||||
SERVER_HOST=${GITHUB_SERVER_URL#http://}
|
GITEA_API=${GITHUB_SERVER_URL%/}/api/v1
|
||||||
SERVER_HOST=${SERVER_HOST#https://}
|
|
||||||
SERVER_HOST=${SERVER_HOST%%/*}
|
|
||||||
|
|
||||||
# Pick the configured host variable matching the running environment.
|
# Public host for the download links baked into the release body.
|
||||||
case "$SERVER_HOST" in
|
HOST=${PUBLIC_HOST:?PUBLIC_HOST variable is not set on this Gitea instance}
|
||||||
"$PROD_HOST") HOST="$PROD_HOST" ;;
|
echo "API base: ${GITEA_API}"
|
||||||
"$STAGING_HOST") HOST="$STAGING_HOST" ;;
|
echo "Public host for release links: ${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}"
|
|
||||||
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/}
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
GITEA_API=https://${HOST}/api/v1
|
|
||||||
REPO=${GITHUB_REPOSITORY}
|
REPO=${GITHUB_REPOSITORY}
|
||||||
|
|
||||||
echo "Creating release for tag ${VERSION} on ${REPO}..."
|
echo "Creating release for tag ${VERSION} on ${REPO}..."
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user