Add GitHub workflow for automated Docker image builds

Creates workflow that triggers on version tags (v*) to automatically build
and publish Docker images to GitHub Container Registry. Non-alpha releases
also create draft GitHub releases for review before publishing.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 20:37:29 -05:00
parent 0509c44497
commit 6e7d4276ea

75
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
name: Build and Publish Docker Image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
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: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ !contains(github.ref_name, 'alpha') }}
labels: |
org.opencontainers.image.title=Windmill Git Sync
org.opencontainers.image.description=Containerized service for synchronizing Windmill workspaces to Git repositories
org.opencontainers.image.vendor=${{ github.repository_owner }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create draft release
if: ${{ !contains(github.ref_name, 'alpha') }}
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
body: |
## Docker Image
Pull this release:
```bash
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
```
Or use the latest tag:
```bash
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
```