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/reusable-docker.yml

74 lines
2.1 KiB

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
on:
workflow_call:
env:
SHOULD_PUBLISH: ${{ startsWith(github.ref, 'refs/tags/') || github.ref_name == 'master' }}
jobs:
docker:
name: Build & Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
# with:
# buildkitd-flags: --debug
- name: Check Version
id: check_version
shell: pwsh
run: ci/Test-Version.ps1 ${{ github.ref_name }}
- name: Set Docker Tags
id: meta
uses: docker/metadata-action@v4
env:
SEMVER: type=semver,enable=${{ steps.check_version.outputs.match }},value=${{ github.ref_name }}
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=edge,branch=master
${{ env.SEMVER }},pattern={{major}}.{{minor}}.{{patch}}
${{ env.SEMVER }},pattern={{major}}.{{minor}}
${{ env.SEMVER }},pattern={{major}}
- name: Grab Artifacts
uses: ./.github/actions/download-tar
with:
path: docker/artifacts
- name: Login to Docker Hub
if: env.SHOULD_PUBLISH == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: env.SHOULD_PUBLISH == 'true'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push Image
uses: docker/build-push-action@v4
with:
context: ./docker
push: ${{ env.SHOULD_PUBLISH == 'true' }}
no-cache: true
platforms: linux/arm/v7,linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}