ci: use docker/metadata-action and build-push-action
All checks were successful
Build and Deploy / Build & Push (push) Successful in 14m31s

Cleaner pipeline using official Docker actions. Supports semver tags
alongside latest. Registry driven by vars.REGISTRY variable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 01:37:09 -04:00
parent 2bc10c98d9
commit 09dcfde16e
2 changed files with 29 additions and 33 deletions

View File

@@ -4,40 +4,37 @@ on:
push:
branches:
- main
tags:
- 'v*'
jobs:
build-and-push:
build-push:
name: Build & Push
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Set image tags
id: image
run: |
# Gitea's container registry lives on the same host as the Gitea instance
REGISTRY="${{ gitea.server_url }}"
REGISTRY="${REGISTRY#https://}"
REGISTRY="${REGISTRY#http://}"
IMAGE="${REGISTRY}/josh/sixflagssupercalendar"
SHA="${{ gitea.sha }}"
echo "registry=${REGISTRY}" >> "$GITHUB_OUTPUT"
echo "tag_latest=${IMAGE}:latest" >> "$GITHUB_OUTPUT"
echo "tag_sha=${IMAGE}:${SHA::8}" >> "$GITHUB_OUTPUT"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.REGISTRY }}/${{ gitea.repository_owner }}/sixflagssupercalendar
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Log in to registry
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | \
docker login "${{ steps.image.outputs.registry }}" -u josh --password-stdin
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build image
run: |
docker build \
-t "${{ steps.image.outputs.tag_latest }}" \
-t "${{ steps.image.outputs.tag_sha }}" \
.
- name: Push image
run: |
docker push "${{ steps.image.outputs.tag_latest }}"
docker push "${{ steps.image.outputs.tag_sha }}"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -116,11 +116,10 @@ The pipeline is defined at [`.gitea/workflows/deploy.yml`](.gitea/workflows/depl
| Type | Name | Value |
|------|------|-------|
| Variable | `REGISTRY` | Registry hostname — `gitea.thewrightserver.net` |
| Secret | `REGISTRY_TOKEN` | A Gitea access token with `package:write` scope |
Set this under **Repository → Settings → Actions → Secrets**.
The registry host is derived automatically from `gitea.server_url` — no `REGISTRY_URL` variable needed.
Set these under **Repository → Settings → Actions → Variables / Secrets**.
#### Upstream remote