You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/.github/workflows/docker.yml

79 lines
2.1 KiB

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Docker Image
on:
push:
paths:
- docker/**
- .github/workflows/docker.yml
pull_request:
paths:
- docker/**
- .github/workflows/docker.yml
release:
types: [ published ]
workflow_dispatch:
inputs:
release_tag:
description: Release Tag
required: true
type: string
should_publish:
description: Publish Image to GHCR?
required: false
default: false
type: boolean
env:
SHOULD_PUBLISH: ${{ github.event_name == 'release' || github.event.inputs.should_publish == 'true' }}
VERSION: ${{ github.event.release.tag_name || github.event.inputs.release_tag }}
jobs:
docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Extract Image Metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ env.VERSION }}
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
type=semver,pattern={{major}},value=${{ env.VERSION }}
- name: Login to GHCR
if: env.SHOULD_PUBLISH
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push Image
uses: docker/build-push-action@v2
with:
context: ./docker
push: ${{ env.SHOULD_PUBLISH }}
no-cache: true
build-args: |
REPOSITORY=${{ github.repository }}
${{ env.VERSION && format('RELEASE_TAG={0}', env.VERSION) }}
platforms: linux/arm/v7,linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}