Skip to content

Docker Publish

Docker Publish #201

name: Docker Publish
on:
push:
branches:
- 'master'
schedule:
- cron: '0 5 * * 0'
workflow_dispatch:
env:
tag: latest
project: plexautoskip-docker
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
-
dockerfile: Dockerfile
platform: amd64
-
dockerfile: Dockerfile
platform: arm64
steps:
-
name: Checkout
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: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./${{ matrix.dockerfile }}
platforms: linux/${{ matrix.platform }}
push: true
provenance: false
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ env.project }}:${{ env.tag }}-${{ matrix.platform }}
ghcr.io/${{ github.repository }}:${{ env.tag }}-${{ matrix.platform }}
publish:
runs-on: ubuntu-latest
needs: [docker]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
-
name: Create manifests
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
docker manifest create \
${{ secrets.DOCKER_USERNAME }}/${{ env.project }}:${{ env.tag }} \
--amend ${{ secrets.DOCKER_USERNAME }}/${{ env.project }}:${{ env.tag }}-amd64 \
--amend ${{ secrets.DOCKER_USERNAME }}/${{ env.project }}:${{ env.tag }}-arm64
docker manifest create \
ghcr.io/${{ github.repository }}:${{ env.tag }} \
--amend ghcr.io/${{ github.repository }}:${{ env.tag }}-amd64 \
--amend ghcr.io/${{ github.repository }}:${{ env.tag }}-arm64
-
name: Push manifests
run: |
docker manifest push ${{ secrets.DOCKER_USERNAME }}/${{ env.project }}:${{ env.tag }}
docker manifest push ghcr.io/${{ github.repository }}:${{ env.tag }}