Skip to content

chore: template gallery cleanup - remove dead code, enhance preview m… #113

chore: template gallery cleanup - remove dead code, enhance preview m…

chore: template gallery cleanup - remove dead code, enhance preview m… #113

# ─────────────────────────────────────────────────────────────
# Build & push Docker image to GitHub Container Registry
# Triggers on every push to main and on tags (v*)
# ─────────────────────────────────────────────────────────────
name: Docker Build & Push
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch: # manual trigger
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# latest on every push to main
type=raw,value=latest,enable={{is_default_branch}}
# sha-abc1234 on every push
type=sha,prefix=sha-
# v1.0.0 on tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64