Skip to content

Publish

Publish #358

Workflow file for this run

name: Publish
on:
schedule:
- cron: "0 0 * * 1,5"
workflow_dispatch:
inputs:
push-registry:
description: 'Push to registry'
type: boolean
required: true
default: true
push:
branches: [main]
paths:
- '**/Dockerfile*'
concurrency:
group: ${{ github.repository }}
cancel-in-progress: true
jobs:
image:
name: "Image"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PUSH_REGISTRY: true
strategy:
fail-fast: false
matrix:
release:
- tags: latest,latest-bookworm-slim
base: mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim
branch: latest
- tags: stg-bookworm-slim
base: mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim
branch: stg
- tags: latest-alpine
base: mcr.microsoft.com/dotnet/sdk:8.0-alpine
branch: latest
- tags: stg-alpine
base: mcr.microsoft.com/dotnet/sdk:8.0-alpine
branch: stg
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout Repository
uses: actions/checkout@v4
- name: Determine whether to push to registry
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "PUSH_REGISTRY=${{ github.event.inputs.push-registry }}" >> $GITHUB_ENV
else
echo "PUSH_REGISTRY=true" >> $GITHUB_ENV
fi
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: true
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ matrix.release.tags }}
- name: Build & Publish Image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ env.PUSH_REGISTRY }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
build-args: |
OS=${{ matrix.release.base }}
DALAMUD_BRANCH=${{ matrix.release.branch }}
cleanup:
name: "Cleanup"
runs-on: ubuntu-latest
needs: [ image ]
permissions:
contents: read
packages: write
steps:
- name: Prune Untagged
uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
container: docker-dalamud
keep-younger-than: 7
prune-untagged: true