Skip to content

v1.0.6

v1.0.6 #14

Workflow file for this run

name: Build and Push Docker Image
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version tag for the Docker image'
required: true
default: 'latest'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry (GHCR)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT || secrets.GITHUB_TOKEN }}
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_AT }}
- name: SetVars
id: set_vars
run: |
# If the workflow is triggered by a release, use the release tag
if [ "${GITHUB_EVENT_NAME}" == "release" ]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
VERSION="${{ github.event.inputs.version }}"
fi
VERSION_LOWER=$(echo $VERSION | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') # Use full lowercase repo name for both GHCR and DockerHub
echo "VERSION=$VERSION_LOWER" >> $GITHUB_ENV
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
- name: Build and Push Docker Image (GitHub Packages)
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ env.REPO_NAME }}:${{ env.VERSION }} \
--tag ghcr.io/${{ env.REPO_NAME }}:latest \
--push .
- name: Build and Push Docker Image (DockerHub)
run: |
docker buildx build --platform linux/amd64,linux/arm64 \
--tag ${{ env.REPO_NAME }}:${{ env.VERSION }} \
--tag ${{ env.REPO_NAME }}:latest \
--push .