Docker Publish #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
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@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
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 }} |