rename files
Some checks failed
Bump Version (via reusable workflow) / bump-version (push) Failing after 7s

This commit is contained in:
2026-01-17 20:44:02 +01:00
parent 19c3a12231
commit d24350cbc4
3 changed files with 48 additions and 38 deletions

View File

@@ -12,6 +12,10 @@ on:
description: Full image name including registry (defaults to REGISTRY/repo) description: Full image name including registry (defaults to REGISTRY/repo)
type: string type: string
default: "" default: ""
tag:
description: Override image tag (defaults to standard tags)
type: string
default: ""
dockerfile: dockerfile:
description: Path to Dockerfile description: Path to Dockerfile
type: string type: string
@@ -44,6 +48,7 @@ jobs:
env: env:
REGISTRY: ${{ inputs.registry != '' && inputs.registry || secrets.REGISTRY }} REGISTRY: ${{ inputs.registry != '' && inputs.registry || secrets.REGISTRY }}
IMAGE_NAME: ${{ inputs.image_name }} IMAGE_NAME: ${{ inputs.image_name }}
TAG_INPUT: ${{ inputs.tag }}
REPO: ${{ gitea.repository }} REPO: ${{ gitea.repository }}
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -84,50 +89,55 @@ jobs:
id: vars id: vars
run: | run: |
IMAGE="${IMAGE_NAME}" IMAGE="${IMAGE_NAME}"
TAG_NAME=""
REF="${GITHUB_REF:-${GITEA_REF}}"
SHA="${GITHUB_SHA:-${GITEA_SHA}}"
BRANCH=""
SHORT_SHA="$(git rev-parse --short=7 "${SHA}")"
TAGS=() TAGS=()
# Extract tag name when we are on a tag ref (e.g. v1.4) if [ -n "${TAG_INPUT}" ]; then
if [[ "${REF}" =~ refs/tags/(.+) ]]; then TAGS+=("${IMAGE}:${TAG_INPUT}")
TAG_NAME="${BASH_REMATCH[1]}"
fi
if [[ "${REF}" =~ refs/heads/(.+) ]]; then
BRANCH="${BASH_REMATCH[1]}"
else else
# Tag build: detect which branch contains the tagged commit TAG_NAME=""
git fetch --no-tags --depth=1 origin main release develop || true REF="${GITHUB_REF:-${GITEA_REF}}"
if git branch -r --contains "${SHA}" | grep -q "origin/main"; then SHA="${GITHUB_SHA:-${GITEA_SHA}}"
BRANCH="main" BRANCH=""
elif git branch -r --contains "${SHA}" | grep -q "origin/release"; then SHORT_SHA="$(git rev-parse --short=7 "${SHA}")"
BRANCH="release"
elif git branch -r --contains "${SHA}" | grep -q "origin/develop"; then # Extract tag name when we are on a tag ref (e.g. v1.4)
BRANCH="develop" if [[ "${REF}" =~ refs/tags/(.+) ]]; then
TAG_NAME="${BASH_REMATCH[1]}"
fi fi
if [[ "${REF}" =~ refs/heads/(.+) ]]; then
BRANCH="${BASH_REMATCH[1]}"
else
# Tag build: detect which branch contains the tagged commit
git fetch --no-tags --depth=1 origin main release develop || true
if git branch -r --contains "${SHA}" | grep -q "origin/main"; then
BRANCH="main"
elif git branch -r --contains "${SHA}" | grep -q "origin/release"; then
BRANCH="release"
elif git branch -r --contains "${SHA}" | grep -q "origin/develop"; then
BRANCH="develop"
fi
fi
TAGS+=("${IMAGE}:${SHORT_SHA}")
[[ -n "${TAG_NAME}" ]] && TAGS+=("${IMAGE}:${TAG_NAME}")
case "${BRANCH}" in
main)
TAGS+=("${IMAGE}:latest")
;;
release*)
TAGS+=("${IMAGE}:latest-rc")
;;
develop)
TAGS+=("${IMAGE}:latest-dev")
;;
*)
TAGS+=("${IMAGE}:latest-snapshot")
;;
esac
fi fi
TAGS+=("${IMAGE}:${SHORT_SHA}")
[[ -n "${TAG_NAME}" ]] && TAGS+=("${IMAGE}:${TAG_NAME}")
case "${BRANCH}" in
main)
TAGS+=("${IMAGE}:latest")
;;
release*)
TAGS+=("${IMAGE}:latest-rc")
;;
develop)
TAGS+=("${IMAGE}:latest-dev")
;;
*)
TAGS+=("${IMAGE}:latest-snapshot")
;;
esac
echo "Computed tags:" echo "Computed tags:"
printf '%s\n' "${TAGS[@]}" printf '%s\n' "${TAGS[@]}"
{ {