2024-01-15 15:14:54 +01:00
|
|
|
name: Docker Build
|
2023-11-22 01:25:06 +01:00
|
|
|
|
2023-02-10 22:47:58 +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
|
2023-02-10 22:47:58 +01:00
|
|
|
type: string
|
2023-11-22 01:25:06 +01:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- created
|
|
|
|
push:
|
|
|
|
branches: ["main"]
|
|
|
|
pull_request:
|
|
|
|
branches: ["main"]
|
2023-02-10 22:47:58 +01:00
|
|
|
|
|
|
|
jobs:
|
2023-12-23 21:58:57 +01:00
|
|
|
build_and_push:
|
2023-02-10 22:47:58 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-10-19 20:23:03 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-02-10 22:47:58 +01:00
|
|
|
with:
|
2023-10-19 20:19:59 +02:00
|
|
|
ref: "main"
|
2023-02-10 22:47:58 +01:00
|
|
|
fetch-depth: 0
|
|
|
|
|
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-12-19 03:14:05 +01:00
|
|
|
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
2023-12-23 22:28:19 +01:00
|
|
|
type=ref,event=tag
|
2023-12-19 03:14:05 +01:00
|
|
|
type=raw,value=${{ inputs.tags }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
2023-10-19 20:19:59 +02:00
|
|
|
|
2023-02-10 22:47:58 +01:00
|
|
|
- name: Set up QEMU
|
2023-10-19 20:23:21 +02:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-02-10 22:47:58 +01:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-10-19 20:23:08 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-02-10 22:47:58 +01:00
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
2023-10-19 20:23:26 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-02-10 22:47:58 +01:00
|
|
|
with:
|
2023-10-19 20:19:59 +02:00
|
|
|
username: ${{ github.repository_owner }}
|
2023-02-10 22:47:58 +01:00
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2023-10-19 20:19:59 +02:00
|
|
|
|
2023-06-21 23:29:41 +02:00
|
|
|
- name: Login to GitHub Container Registry
|
2023-10-19 20:23:26 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-06-21 23:29:41 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GH_TOKEN }}
|
2023-02-10 22:47:58 +01:00
|
|
|
|
2023-06-21 23:29:41 +02:00
|
|
|
- name: Build and push
|
2023-10-19 20:23:18 +02:00
|
|
|
uses: docker/build-push-action@v5
|
2023-02-10 22:47:58 +01:00
|
|
|
with:
|
|
|
|
context: ./
|
|
|
|
platforms: linux/arm/v7,linux/amd64,linux/arm64
|
2023-12-19 03:14:05 +01:00
|
|
|
push: ${{ !github.event.pull_request.head.repo.fork }}
|
2023-10-19 20:19:59 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2024-01-15 15:14:54 +01:00
|
|
|
build-args: BUILD_VERSION=${{ github.event.release.name }}
|