docker-publish.yml•1.86 kB
name: Build & Publish Docker
on:
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
VERSION: latest
IS_TAG: 'false'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Determine version
id: ver
run: |
# If this run is triggered by a tag, derive VERSION from the tag (strip leading "v")
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VER=${GITHUB_REF#refs/tags/}
VER=${VER#v}
echo "VERSION=${VER}" >> $GITHUB_ENV
echo "IS_TAG=true" >> $GITHUB_ENV
# local copies so this step's logs show the resolved values
VERSION="${VER}"
IS_TAG=true
else
echo "VERSION=latest" >> $GITHUB_ENV
echo "IS_TAG=false" >> $GITHUB_ENV
VERSION=latest
IS_TAG=false
fi
echo "Using REF=${GITHUB_REF}, VERSION=${VERSION}, IS_TAG=${IS_TAG}"
- name: Set up QEMU (for multi-arch builds)
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push multi-arch image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/overseerr-mcp:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/overseerr-mcp:latest