added configs and gitea worker

This commit is contained in:
C-West8
2026-07-22 15:18:27 -05:00
parent 086542169c
commit 5c9f30b1cf
4 changed files with 143 additions and 75 deletions

View File

@@ -0,0 +1,55 @@
# Builds the Docker image and pushes it to Gitea's built-in container registry
# on every push to main. Tags each build as :latest and :<commit-sha>.
#
# PREREQUISITES on your Gitea instance:
# 1. Actions must be enabled (app.ini: [actions] ENABLED = true) and at least
# one act_runner registered.
# 2. The runner must be able to build images. act_runner needs access to a
# Docker daemon — either run the runner with the host Docker socket mounted
# (-v /var/run/docker.sock:/var/run/docker.sock) or in docker-in-docker mode.
# 3. The Package Registry must be enabled (it is by default).
#
# TOKEN: the workflow tries the auto-injected GITHUB_TOKEN first. If your Gitea
# version does not grant it package-write scope, create a Personal Access Token
# with "write:package" scope and add it as a repository secret named
# REGISTRY_TOKEN (Repo > Settings > Actions > Secrets).
name: build-image
on:
push:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute registry host and image name
id: meta
run: |
# Registry host = the Gitea instance host (strip the scheme).
echo "registry=$(echo '${{ github.server_url }}' | sed -E 's#^https?://##')" >> "$GITHUB_OUTPUT"
# Image path must be lowercase for OCI registries.
echo "image=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Gitea container registry
uses: docker/login-action@v3
with:
registry: ${{ steps.meta.outputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ steps.meta.outputs.registry }}/${{ steps.meta.outputs.image }}:latest
${{ steps.meta.outputs.registry }}/${{ steps.meta.outputs.image }}:${{ github.sha }}