Skip to content

Merge pull request #21 from adfinis/dependabot/docker/ubi8/ubi-minima… #13

Merge pull request #21 from adfinis/dependabot/docker/ubi8/ubi-minima…

Merge pull request #21 from adfinis/dependabot/docker/ubi8/ubi-minima… #13

name: Build and Publish Docker Image
on:
push:
branches:
- "**" # Trigger on push to any branch
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract branch name
id: extract_branch
run: echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Replace slashes in branch name
id: sanitize_branch
run: |
sanitized_branch_name=$(echo "${{ env.branch_name }}" | tr '/' '-')
echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push the Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ env.sanitized_branch_name }}-nightly