diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 7c6f070..7c81213 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -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}..."