Compare commits

..
2 Commits
Author SHA1 Message Date
Felix FaerberandClaude Opus 5 e47e62780a push with a write:package token, not the Actions token
Docker / build (push) Failing after 4s
Second build failed the same way: docker login to this instance's registry
returns "unauthorized" for the automatic Actions token, and declaring
permissions: packages: write did not change it -- Gitea's task token is accepted
by the API but not by the package registry.

So the push uses REGISTRY_TOKEN, an org secret holding a personal access token
scoped to write:package and nothing else. The step fails with that sentence in
the log rather than another bare "unauthorized", because the difference
between a missing secret and a rejected credential is not visible from the
error docker prints.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-15 12:38:14 +03:00
Felix FaerberandClaude Opus 5 d6fc2477f3 declare packages: write so the registry login works
Docker / build (push) Failing after 4s
The first build pushed nothing: `docker login git.ffaerber.duckdns.org` came
back "unauthorized". Gitea scopes the automatic Actions token from the job's
permissions block, and without one it has no package write -- so the build
succeeded and the push failed on auth, which reads like a credential problem
rather than a missing declaration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-15 12:36:51 +03:00
+11 -1
View File
@@ -35,7 +35,17 @@ jobs:
if: github.event_name != 'pull_request'
run: |
set -eu
echo "${{ secrets.GITEA_TOKEN }}" | docker login git.ffaerber.duckdns.org -u "${{ github.actor }}" --password-stdin
# Not the automatic Actions token: this Gitea's package registry rejects
# it (docker login returns a bare "unauthorized"), with or without a
# permissions: packages: write block. REGISTRY_TOKEN is an org secret
# holding a personal access token scoped to write:package only.
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
echo "REGISTRY_TOKEN is not set — create a token with the write:package scope" >&2
echo "and add it as an org secret on token-for-token. The image built fine;" >&2
echo "only the push needs it." >&2
exit 1
fi
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.ffaerber.duckdns.org -u "${{ vars.REGISTRY_USER || 'ffaerber' }}" --password-stdin
docker tag "$IMAGE:$SHA" "$IMAGE:latest"
docker push "$IMAGE:$SHA"
docker push "$IMAGE:latest"