Files
short/.github/workflows/docker-publish.yml
T
traberphandClaude Opus 5.5 95c27e7353 Update GitHub Actions to their Node 24 versions
Node 20 is deprecated on GitHub runners. All inputs used here are
unchanged in the new major versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:26:41 +02:00

91 lines
2.5 KiB
YAML

name: Build and Push Docker Images
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
env:
REGISTRY: ghcr.io
DOCKER_HUB_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
DOCKER_HUB_IMAGE_NAME: traberph/short
PRIVATE_REGISTRY: registry.traberph.de
PRIVATE_IMAGE_NAME: public/short
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm test
- run: pnpm build
build-and-push:
needs: test
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
registry: ${{ env.DOCKER_HUB_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to registry.traberph.de
uses: docker/login-action@v4
with:
registry: ${{ env.PRIVATE_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.DOCKER_HUB_REGISTRY }}/${{ env.DOCKER_HUB_IMAGE_NAME }}
${{ env.PRIVATE_REGISTRY }}/${{ env.PRIVATE_IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/heads/main') }}
- name: Build and push Docker images
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max