Files
WorkWeekProgress/.gitea/workflows/build-push.yml
T
josh 9ecdfe7cd1
Build and Push Image / build-push (push) Successful in 43s
Strip scheme from REGISTRY_URL before tagging
Docker image tags must start with a hostname — a `https://` prefix in
the REGISTRY_URL variable produced `invalid reference format`. Normalize
the value in a prep step (drop http/https scheme and trailing slash) so
the workflow works whether the variable is set as a URL or a bare host.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 10:23:49 -04:00

45 lines
1.1 KiB
YAML

name: Build and Push Image
on:
push:
branches: [main]
env:
IMAGE: josh/workweekprogress
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare build vars
id: vars
run: |
host="${{ vars.REGISTRY_URL }}"
host="${host#https://}"
host="${host#http://}"
host="${host%/}"
echo "registry=$host" >> "$GITHUB_OUTPUT"
echo "sha_short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea registry
uses: docker/login-action@v3
with:
registry: ${{ steps.vars.outputs.registry }}
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ steps.vars.outputs.registry }}/${{ env.IMAGE }}:latest
${{ steps.vars.outputs.registry }}/${{ env.IMAGE }}:sha-${{ steps.vars.outputs.sha_short }}