All checks were successful
Build and Push Docker Image / build (push) Successful in 8m35s
83 lines
2.5 KiB
YAML
83 lines
2.5 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Custom tag for the image'
|
|
required: false
|
|
default: 'manual'
|
|
|
|
env:
|
|
REGISTRY: dev.pivoine.art
|
|
IMAGE_NAME: valknar/realesrgan-api
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
platforms: linux/amd64
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha,prefix={{branch}}-
|
|
type=raw,value=${{ gitea.event.inputs.tag }},enable=${{ gitea.event_name == 'workflow_dispatch' }}
|
|
labels: |
|
|
org.opencontainers.image.title=realesrgan-api
|
|
org.opencontainers.image.description=REST API for Real-ESRGAN image upscaling
|
|
org.opencontainers.image.vendor=valknar
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: ${{ gitea.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
|
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
|
|
|
|
- name: Summary
|
|
if: gitea.event_name != 'pull_request'
|
|
run: |
|
|
echo "### Image Published" >> $GITEA_STEP_SUMMARY
|
|
echo "**Tags:**" >> $GITEA_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITEA_STEP_SUMMARY
|
|
echo "${{ steps.meta.outputs.tags }}" >> $GITEA_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITEA_STEP_SUMMARY
|