6a3a5c52ce
Build and Push Container / build (push) Failing after 10m35s
Triggers on push to main (tags: latest, short SHA) and on semver tags (tags: x.y.z, x.y, short SHA). Pushes to the Gitea built-in registry at <gitea-host>/<owner>/announcements. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Build and Push Container
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Extract registry hostname
|
|
id: registry
|
|
run: |
|
|
echo "host=$(echo '${{ gitea.server_url }}' | sed 's|https://||;s|http://||')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ steps.registry.outputs.host }}/${{ gitea.repository_owner }}/announcements
|
|
tags: |
|
|
# latest on main branch
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
# branch name on non-main pushes
|
|
type=ref,event=branch,enable=${{ gitea.ref_name != 'main' }}
|
|
# semver tags: v1.2.3 → 1.2.3 and 1.2
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
# short SHA always
|
|
type=sha,prefix=,format=short
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ steps.registry.outputs.host }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: Containerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|