feat: fix manuel pipline. to create a release tag or replace exisiting release

This commit is contained in:
2026-05-29 19:20:32 +02:00
parent cceda8abf2
commit 5feae97dd3
3 changed files with 48 additions and 16 deletions
+24 -10
View File
@@ -1,5 +1,6 @@
# Builds and pushes a multi-arch Docker image to the Gitea container registry
# whenever a semver tag (v*.*.*) is pushed.
# Builds and pushes a multi-arch Docker image to the Gitea container registry.
# Triggered manually via workflow_dispatch — enter an existing semver tag (e.g. 1.2.3)
# in the "Release tag" input. The workflow will fail early if the tag does not exist.
#
# One-time setup required:
# 1. Create a Gitea token with "package:write" scope.
@@ -12,9 +13,12 @@
name: Docker Publish
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (semver, e.g. 1.2.3)'
required: true
type: string
jobs:
build-push:
@@ -23,6 +27,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate tag exists
run: |
if ! git rev-parse "refs/tags/${{ inputs.tag }}" >/dev/null 2>&1; then
echo "Error: tag '${{ inputs.tag }}' does not exist in this repository."
exit 1
fi
git checkout "refs/tags/${{ inputs.tag }}"
# Strip the protocol from the server URL to get the registry hostname.
# e.g. https://gitea.example.com → gitea.example.com
@@ -30,17 +44,17 @@ jobs:
run: |
echo "REGISTRY=$(echo '${{ gitea.server_url }}' | sed 's|https://||;s|http://||')" >> $GITHUB_ENV
# Generates OCI-compliant tags and labels from the git tag.
# v1.2.3 → image tags: 1.2.3 / 1.2 / 1
# Generates OCI-compliant tags and labels from the provided release tag.
# 1.2.3 → image tags: 1.2.3 / 1.2 / 1
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ gitea.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{version}},value=${{ inputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag }}
type=semver,pattern={{major}},value=${{ inputs.tag }}
# QEMU enables emulation of arm64 on the amd64 runner.
- name: Set up QEMU