2025-01-05 22:02:36 +00:00
|
|
|
name: Docker Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2025-03-04 15:07:33 +00:00
|
|
|
branches: [main, stable]
|
|
|
|
tags: ['v*', '*.*.*']
|
2025-02-23 17:45:56 +00:00
|
|
|
workflow_dispatch:
|
2025-01-05 22:02:36 +00:00
|
|
|
|
2025-03-04 15:07:33 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2025-01-06 05:04:31 +00:00
|
|
|
permissions:
|
|
|
|
packages: write
|
2025-01-06 08:27:16 +00:00
|
|
|
contents: read
|
2025-01-06 05:04:31 +00:00
|
|
|
|
2025-01-05 22:02:36 +00:00
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
2025-02-23 17:45:56 +00:00
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
2025-01-05 22:02:36 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker-build-publish:
|
|
|
|
runs-on: ubuntu-latest
|
2025-03-04 15:07:33 +00:00
|
|
|
# timeout-minutes: 30
|
2025-01-05 22:02:36 +00:00
|
|
|
steps:
|
2025-02-23 17:45:56 +00:00
|
|
|
- name: Checkout code
|
2025-01-05 22:02:36 +00:00
|
|
|
uses: actions/checkout@v4
|
2025-03-04 14:58:51 +00:00
|
|
|
|
2025-01-05 22:02:36 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2025-03-04 15:07:33 +00:00
|
|
|
|
2025-02-23 17:45:56 +00:00
|
|
|
- name: Log in to GitHub Container Registry
|
2025-01-05 22:02:36 +00:00
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
2025-02-23 17:45:56 +00:00
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata for Docker image
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2025-03-04 14:58:51 +00:00
|
|
|
tags: |
|
2025-03-04 15:07:33 +00:00
|
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/stable' }}
|
2025-03-04 14:58:51 +00:00
|
|
|
type=ref,event=tag
|
2025-03-04 15:07:33 +00:00
|
|
|
type=sha,format=short
|
|
|
|
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stable' }}
|
2025-01-05 22:02:36 +00:00
|
|
|
|
2025-03-04 15:07:33 +00:00
|
|
|
- name: Build and push Docker image
|
2025-01-05 22:02:36 +00:00
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
context: .
|
2025-03-04 14:58:51 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2025-01-05 22:02:36 +00:00
|
|
|
push: true
|
2025-03-04 15:07:33 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2025-03-04 14:58:51 +00:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2025-03-04 15:07:33 +00:00
|
|
|
|
|
|
|
- name: Check manifest
|
|
|
|
run: docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
|