Skip to content

trigger-docker-workflow #21

trigger-docker-workflow

trigger-docker-workflow #21

name: Build & Publish Docker image
on:
repository_dispatch:
workflow_dispatch:
inputs:
version:
description: Version number
required: true
type: string
jobs:
publish:
name: Build & Publish to DockerHub and GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Establish variables
id: vars
run: |
VERSION=$(cat VERSION)
echo ::set-output name=version::${VERSION}
echo ::set-output name=today::$(date +'%Y-%m-%d')
echo ::set-output name=year::$(date +'%Y')
- name: Update version number
uses: jacobtomlinson/[email protected]
with:
find: "VERSIONADDEDBYGITHUB"
replace: "${{ steps.vars.outputs.version }}"
regex: false
- name: Update copyright year
uses: jacobtomlinson/[email protected]
with:
find: "YEARADDEDBYGITHUB"
replace: "${{ steps.vars.outputs.year }}"
regex: false
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: docker-buildx
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
builder: ${{ steps.docker-buildx.outputs.name }}
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/armhf,linux/arm64
tags: |
mtrogman/managarr:latest
mtrogman/managarr:${{ steps.vars.outputs.version }}
ghcr.io/mtrogman/managarr:latest
ghcr.io/mtrogman/managarr:${{ steps.vars.outputs.version }}
labels: |
org.opencontainers.image.title=tauticord
org.opencontainers.image.version=${{ steps.vars.outputs.version }}
org.opencontainers.image.created=${{ steps.vars.outputs.today }}