feat(workflow): add manual trigger and tag input for Docker image builds

- Introduce a `workflow_dispatch` event to allow manual triggering of the Docker image build workflow.
- Add an input parameter for specifying the tag name, enhancing flexibility in build processes.
- Update tag resolution logic to prioritize the input tag when provided, ensuring accurate versioning during builds.
This commit is contained in:
CaIon
2026-02-04 00:09:02 +08:00
parent 85b5d0100a
commit 35a4c586aa

View File

@@ -4,6 +4,12 @@ on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag name to build (e.g., v0.10.8-alpha.3)'
required: true
type: string
jobs:
build_single_arch:
@@ -33,7 +39,11 @@ jobs:
- name: Resolve tag & write VERSION
run: |
git fetch --tags --force --depth=1
TAG=${GITHUB_REF#refs/tags/}
if [ -n "${{ github.event.inputs.tag }}" ]; then
TAG="${{ github.event.inputs.tag }}"
else
TAG=${GITHUB_REF#refs/tags/}
fi
echo "TAG=$TAG" >> $GITHUB_ENV
echo "$TAG" > VERSION
echo "Building tag: $TAG for ${{ matrix.arch }}"
@@ -87,10 +97,15 @@ jobs:
name: Create multi-arch manifests (Docker Hub)
needs: [build_single_arch]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Extract tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
#
# - name: Normalize GHCR repository
# run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV