mirror of
https://github.com/Xe138/windmill-git-sync.git
synced 2026-04-01 17:27:23 -04:00
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>
76 lines
2.2 KiB
YAML
76 lines
2.2 KiB
YAML
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
|
|
```
|