immich-exporter/.github/workflows/docker.yml

79 lines
2.3 KiB
YAML
Raw Normal View History

name: Publish Release
2023-11-22 01:25:06 +01:00
on:
workflow_dispatch:
inputs:
tags:
2023-10-19 20:19:59 +02:00
description: "version"
2023-11-22 01:25:06 +01:00
required: false
type: string
2023-11-22 01:25:06 +01:00
release:
types:
- created
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build_docker_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
2023-10-19 20:19:59 +02:00
ref: "main"
fetch-depth: 0
2023-11-22 01:25:06 +01:00
- name: Release tag
id: releasetag
run: |
if [ -z "${{ inputs.tag }}" ]; then
latest_release_tag=$(curl -s "https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/latest" | jq -r .tag_name)
echo "release_tag=${latest_release_tag}" >> $GITHUB_ENV
else
echo "release_tag=${{ inputs.tag }}" >> $GITHUB_ENV
fi
2023-10-19 20:19:59 +02:00
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
tags: |
2023-11-22 01:25:06 +01:00
type=raw,value=latest,enable=true
2023-10-19 20:19:59 +02:00
type=sha
2023-11-22 01:25:06 +01:00
type=raw,value=${{ steps.releasetag.outputs.release_tag }},enable=true
2023-10-19 20:19:59 +02:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
2023-10-19 20:19:59 +02:00
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2023-11-22 01:25:06 +01:00
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
2023-10-19 20:19:59 +02:00
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
2023-11-22 01:25:06 +01:00
if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./
platforms: linux/arm/v7,linux/amd64,linux/arm64
2023-11-22 01:25:06 +01:00
push: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
2023-10-19 20:19:59 +02:00
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}