printhive/.forgejo/workflows/build.yml
dlawler489 3a6a2143ef
All checks were successful
build-and-push / docker (push) Successful in 15s
CI: push image using a Forgejo access token
The auto GITHUB_TOKEN lacks package-write scope (push failed with
unauthorized: reqPackageAccess). Use a REGISTRY_TOKEN secret (Forgejo
token with write:package) and log in as the repo owner instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 17:48:57 +10:00

30 lines
881 B
YAML

name: build-and-push
on:
push:
branches: [main]
tags: ['v*']
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Forgejo container registry
# REGISTRY_TOKEN = a Forgejo access token with write:package scope, added
# as a repo Actions secret. The auto GITHUB_TOKEN can't push packages.
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.plexultra.com -u "${{ github.repository_owner }}" --password-stdin
- name: Build and push image
run: |
IMAGE="git.plexultra.com/${{ github.repository }}"
SHA="${{ github.sha }}"
docker build -t "$IMAGE:latest" -t "$IMAGE:${SHA:0:12}" .
docker push "$IMAGE:latest"
docker push "$IMAGE:${SHA:0:12}"