chore: updated workflow for release tagging
This commit is contained in:
parent
0230b4833b
commit
b1cc6f4097
1 changed files with 53 additions and 47 deletions
100
.github/workflows/build_and_publish_docker_image.yml
vendored
100
.github/workflows/build_and_publish_docker_image.yml
vendored
|
|
@ -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
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ steps.docker_image_name.outputs.value }}
|
|
||||||
ghcr.io/${{ steps.docker_image_name.outputs.value }}
|
|
||||||
tags: type=raw,value=latest
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Remove "_Docker" suffix from GitHub repository name to use it as image name
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: mad9000/actions-find-and-replace-string@3
|
||||||
|
id: docker_image_name
|
||||||
- name: Set up Docker Buildx
|
with:
|
||||||
uses: docker/setup-buildx-action@v3
|
source: ${{ github.repository }}
|
||||||
|
find: "_Docker"
|
||||||
|
replace: ""
|
||||||
|
|
||||||
- name: Build and publish Docker image
|
- name: Docker meta
|
||||||
uses: docker/build-push-action@v4
|
id: meta
|
||||||
with:
|
uses: docker/metadata-action@v5
|
||||||
context: .
|
with:
|
||||||
platforms: linux/amd64,linux/arm64
|
images: |
|
||||||
file: ./Dockerfile
|
${{ steps.docker_image_name.outputs.value }}
|
||||||
push: true
|
ghcr.io/${{ steps.docker_image_name.outputs.value }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
flavor: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
latest=auto
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and publish Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue