Files
2025-02-07 09:26:11 -03:00

64 lines
1.9 KiB
YAML

name: Deploy Docker image to GitHub Container Registry and Docker Hub
on:
push:
tags:
- 'v*' # Trigger on any tag that starts with 'v'
workflow_dispatch:
inputs:
tag:
description: 'Tag for the Docker image (e.g., v1.0.0)'
required: true
jobs:
docker:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Determine tag name
- name: Set tag name
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
# Set up QEMU for multi-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Log in to GitHub Container Registry (GHCR)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push Docker image to both GHCR and Docker Hub
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ secrets.GHCR_USERNAME }}/tmdb-addon:${{ env.TAG }}
ghcr.io/${{ secrets.GHCR_USERNAME }}/tmdb-addon:latest
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/tmdb-addon:${{ env.TAG }}
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/tmdb-addon:latest