ci: registry login via REGISTRY_TOKEN secret — Actions token is rejected
docker was present on the echolot runner; the login failed because Gitea's container registry does not accept the ephemeral Actions token. Requires a PAT with package read/write scope as the REGISTRY_TOKEN repo secret (REGISTRY_USER optional, defaults to the actor); fails with a self-explanatory error when missing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
234622549c
commit
ebcb012450
@@ -9,8 +9,13 @@
|
||||
# Tags are namespaced (server-v1.2.3) so app releases (v*) and server
|
||||
# releases don't trigger each other's pipelines.
|
||||
#
|
||||
# Required secrets: none beyond the built-in GITHUB_TOKEN — it can push to
|
||||
# the registry of its own repo and create releases.
|
||||
# Required secrets:
|
||||
# REGISTRY_TOKEN personal access token with read+write package scope —
|
||||
# the built-in Actions token is NOT accepted by the
|
||||
# container registry (docker login → unauthorized).
|
||||
# Create: user Settings → Applications → Generate token.
|
||||
# REGISTRY_USER optional; defaults to the pushing actor's username.
|
||||
# The release job needs only the built-in GITHUB_TOKEN.
|
||||
|
||||
name: server-release
|
||||
on:
|
||||
@@ -79,9 +84,13 @@ jobs:
|
||||
echo "image=$HOST/${GITHUB_REPOSITORY,,}-server" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build + push image (needs a Docker-capable runner)
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER || github.actor }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
command -v docker >/dev/null || { echo "::error::no docker on this runner — image skipped; binaries/release are unaffected"; exit 1; }
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login "${{ steps.meta.outputs.host }}" -u "$GITHUB_ACTOR" --password-stdin
|
||||
[ -n "$REGISTRY_TOKEN" ] || { echo "::error::secret REGISTRY_TOKEN missing — the registry rejects the built-in Actions token. Create a PAT with package read/write scope and add it under Settings → Actions → Secrets."; exit 1; }
|
||||
echo "$REGISTRY_TOKEN" | docker login "${{ steps.meta.outputs.host }}" -u "$REGISTRY_USER" --password-stdin
|
||||
docker build server \
|
||||
--build-arg VERSION=${{ steps.meta.outputs.version }} \
|
||||
-t "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}" \
|
||||
|
||||
Reference in New Issue
Block a user