fix: authenticate to container registry with a package-scoped PAT #2

Merged
lyrathorpe merged 1 commits from fix/ci-registry-auth into main 2026-06-11 16:36:31 +01:00
2 changed files with 13 additions and 5 deletions
+5 -2
View File
@@ -23,13 +23,16 @@ jobs:
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
# Uses a Personal Access Token with package read/write scope, stored as
# the PACKAGES_TOKEN secret. The auto-provided GITEA_TOKEN does not carry
# container-registry write permission on most Gitea instances.
- name: Log in to the Gitea container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITEA_TOKEN }}
username: ${{ github.repository_owner }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Extract image metadata
id: meta
+8 -3
View File
@@ -46,9 +46,14 @@ docker run --rm -p 8080:8080 dlr
`.gitea/workflows/build-and-publish.yml` builds the container with Gitea Actions
and publishes it to this Gitea instance's container registry on pushes to `main`
and on `v*` tags. Pull requests build the image but do not push. Authentication
uses the automatically provided `GITEA_TOKEN`; the registry host is derived from
the Gitea server URL.
and on `v*` tags. Pull requests build the image but do not push. The registry
host is derived from the Gitea server URL.
Authentication requires a Personal Access Token with package read/write scope,
because the automatically provided `GITEA_TOKEN` does not carry container
registry write permission on most Gitea instances. Create the token under an
account with write access to the target package namespace, then store it as a
repository Actions secret named `PACKAGES_TOKEN`.
The published image is `<gitea-host>/<owner>/<repo>`, tagged by branch, semver
(for `v*` tags), commit SHA, and `latest` on the default branch.