chore: updated workflow for release tagging

This commit is contained in:
Matthew McKinnon 2025-01-27 13:14:35 +10:00
parent 0230b4833b
commit b1cc6f4097

View file

@ -2,60 +2,66 @@ name: Docker image CI
on: on:
push: push:
branches: [ master ] tags: ["v*.*.*"]
paths-ignore: paths-ignore:
- '**/README.md' - "**/README.md"
jobs: jobs:
build: build:
name: Build and publish Docker image to Docker Hub and GitHub Containers Repository name: Build and publish Docker image to Docker Hub and GitHub Containers Repository
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Remove "_Docker" suffix from GitHub repository name to use it as image name - name: Generate release note
uses: mad9000/actions-find-and-replace-string@3 uses: softprops/action-gh-release@v1
id: docker_image_name with:
with: generate_release_notes: true
source: ${{ github.repository }}
find: '_Docker'
replace: ''
- name: Docker meta - name: Remove "_Docker" suffix from GitHub repository name to use it as image name
id: meta uses: mad9000/actions-find-and-replace-string@3
uses: docker/metadata-action@v5 id: docker_image_name
with: with:
images: | source: ${{ github.repository }}
${{ steps.docker_image_name.outputs.value }} find: "_Docker"
ghcr.io/${{ steps.docker_image_name.outputs.value }} replace: ""
tags: type=raw,value=latest
- name: Login to Docker Hub - name: Docker meta
uses: docker/login-action@v3 id: meta
with: uses: docker/metadata-action@v5
username: ${{ secrets.DOCKERHUB_USERNAME }} with:
password: ${{ secrets.DOCKERHUB_TOKEN }} images: |
${{ steps.docker_image_name.outputs.value }}
ghcr.io/${{ steps.docker_image_name.outputs.value }}
flavor: |
latest=auto
- name: Login to GitHub Container Registry - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ github.repository_owner }} password: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU - name: Login to GitHub Container Registry
uses: docker/setup-qemu-action@v3 uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx - name: Set up QEMU
uses: docker/setup-buildx-action@v3 uses: docker/setup-qemu-action@v3
- name: Build and publish Docker image - name: Set up Docker Buildx
uses: docker/build-push-action@v4 uses: docker/setup-buildx-action@v3
with:
context: . - name: Build and publish Docker image
platforms: linux/amd64,linux/arm64 uses: docker/build-push-action@v4
file: ./Dockerfile with:
push: true context: .
tags: ${{ steps.meta.outputs.tags }} platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }} file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}