Skip to content

Merge pull request #344 from spoo-me/feat/ab-variants #87

Merge pull request #344 from spoo-me/feat/ab-variants

Merge pull request #344 from spoo-me/feat/ab-variants #87

Workflow file for this run

name: Build Image (edge)
# Every merge to main pushes an immutable sha-tagged image plus a moving
# `edge` tag. Nothing deploys from here — deploys happen on release publish
# (deploy.yml). This keeps every merge one dispatch away from prod (or from
# a rollback) and keeps the buildx cache warm so release builds are fast.
#
# workflow_dispatch builds ANY ref (e.g. a feature branch for the beta
# slice) as a sha-only image — the `edge` tag is guarded to push events
# so branch builds can never steal it from main.
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.rst'
- 'docs/**'
workflow_dispatch:
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Short sha
id: sha
run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
type=sha,prefix=,format=short
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_VERSION=${{ steps.sha.outputs.short }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64