2025-01-05 22:02:36 +00:00
|
|
|
name: Docker Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2025-02-23 17:45:56 +00:00
|
|
|
- stable
|
|
|
|
workflow_dispatch:
|
2025-01-05 22:02:36 +00:00
|
|
|
|
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
|
|
|
|
steps:
|
2025-02-23 17:45:56 +00:00
|
|
|
- name: Checkout code
|
2025-01-05 22:02:36 +00:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
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-01-05 22:02:36 +00:00
|
|
|
|
2025-02-24 22:27:42 +00:00
|
|
|
- name: Build and push Docker image for main
|
|
|
|
if: github.ref == 'refs/heads/main'
|
2025-01-05 22:02:36 +00:00
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
2025-02-23 17:45:56 +00:00
|
|
|
tags: |
|
2025-02-24 22:27:42 +00:00
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image for stable
|
|
|
|
if: github.ref == 'refs/heads/stable'
|
|
|
|
uses: docker/build-push-action@v6
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:stable
|
2025-02-23 17:45:56 +00:00
|
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|