The automatic Actions token is refused by the container registry (run 107: unauthorized). Use the REGISTRY_TOKEN repository secret. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
# Gitea Actions workflow for StarPunk
|
|
# Builds and pushes container images on version tags.
|
|
#
|
|
# The runner has no Docker daemon (that would give workflows root on the
|
|
# server). Images are built by the rootless BuildKit container next to it,
|
|
# reached through its socket.
|
|
name: Build Container
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: git.thesatelliteoflove.com
|
|
BUILDKIT: unix:///run/buildkit/buildkit/buildkitd.sock
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
steps:
|
|
- name: Install dependencies
|
|
run: apk add --no-cache nodejs git docker-cli docker-cli-buildx
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
# The automatic Actions token can't log in to the container registry, so
|
|
# this uses a personal access token with only the write:package scope,
|
|
# stored as the repository secret REGISTRY_TOKEN.
|
|
- name: Log in to the Gitea registry
|
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.repository_owner }}" --password-stdin
|
|
- name: Use the BuildKit socket
|
|
run: docker buildx create --name ci --driver remote "$BUILDKIT" --use
|
|
- name: Build and push
|
|
run: |
|
|
image="$REGISTRY/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
|
|
docker buildx build --push -f Containerfile \
|
|
-t "$image:${{ github.ref_name }}" -t "$image:latest" .
|
|
- name: Clean up
|
|
if: always()
|
|
run: |
|
|
docker buildx rm ci || true
|
|
docker logout "$REGISTRY" || true
|