3 Commits
v1 ... v3
Author SHA1 Message Date
UltimateCoderandClaude Sonnet 5 24679c9549 fix(docker): use absolute URL for replace-build-vars action ref
Step-level 'uses:' resolves non-fully-qualified action refs against
github.com by default, unlike job-level reusable-workflow 'uses:' which
resolves against the local Gitea instance. Verified via a live CI run
that the shorthand form failed with "authentication required:
Repository not found" trying to clone from github.com/UltimateCoder/...

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVTCJvvJmS4fCSrm5wxwVo
2026-09-05 14:00:51 +02:00
UltimateCoderandClaude Sonnet 5 b0ce78f80f Add replace-build-vars composite action, wire into docker.yaml
Replaces {{BUILD_VAR_*}} placeholders in all text files of the calling
repo's checkout with Gitea Actions build/commit/branch info before the
docker build step runs. Language-agnostic (plain text substitution),
runs unconditionally, no-op when no placeholders are present.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVTCJvvJmS4fCSrm5wxwVo
2026-09-05 13:39:20 +02:00
UltimateCoderandClaude Sonnet 4.6 c52dc1f989 fix(docker): push image on PR builds, fix feature branch tags
- Add PR support: build pushes :latest and :pr-<number> tag
- Fix feature branch tags: replace / with - to produce valid Docker tags

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-04-26 14:39:58 +02:00
2 changed files with 54 additions and 2 deletions

No files matched your search

+12 -2
View File
@@ -43,6 +43,9 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Replace build placeholders
uses: https://git.custom-coding.net/UltimateCoder/resuable-workflows/actions/replace-build-vars@v3
- name: Build Image - name: Build Image
run: | run: |
docker build \ docker build \
@@ -59,16 +62,23 @@ jobs:
- name: Docker Release - Dev - name: Docker Release - Dev
if: startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/feature/') if: startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/feature/')
run: | run: |
docker image tag "$IMAGE:latest" "$IMAGE:${GITHUB_REF_NAME}" TAG="${GITHUB_REF_NAME//\//-}"
docker image tag "$IMAGE:latest" "$IMAGE:${TAG}"
- name: Docker Release - Tagged - name: Docker Release - Tagged
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
run: | run: |
docker image tag "$IMAGE:latest" "$IMAGE:${GITHUB_REF_NAME}" docker image tag "$IMAGE:latest" "$IMAGE:${GITHUB_REF_NAME}"
- name: Docker Release - PR
if: startsWith(github.ref, 'refs/pull/')
run: |
PR_NUM=${GITHUB_REF#refs/pull/}
PR_NUM=${PR_NUM%/head}
docker image tag "$IMAGE:latest" "$IMAGE:pr-${PR_NUM}"
- name: Docker Push - name: Docker Push
if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/feature/') || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/pull/')
env: env:
USERNAME: ${{ secrets.DockerUsername }} USERNAME: ${{ secrets.DockerUsername }}
PASSWORD: ${{ secrets.DockerPassword }} PASSWORD: ${{ secrets.DockerPassword }}
+42
View File
@@ -0,0 +1,42 @@
name: Replace Build Placeholders
description: >
Ersetzt {{BUILD_VAR_*}}-Platzhalter in allen Textdateien durch Gitea-Actions-Build-Infos
(Commit, Branch, Run-Metadaten, …). Sprachunabhängig (reiner Text-Replace,
kein Build-Tool-Bezug), kein Input nötig.
runs:
using: composite
steps:
- shell: bash
run: |
set -euo pipefail
SHA_SHORT="${GITHUB_SHA:0:7}"
BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
declare -A VARS=(
[BUILD_VAR_GITHUB_SHA]="${GITHUB_SHA:-}"
[BUILD_VAR_GITHUB_REF_NAME]="${GITHUB_REF_NAME:-}"
[BUILD_VAR_GITHUB_REF_TYPE]="${GITHUB_REF_TYPE:-}"
[BUILD_VAR_GITHUB_REPOSITORY]="${GITHUB_REPOSITORY:-}"
[BUILD_VAR_GITHUB_REPOSITORY_OWNER]="${GITHUB_REPOSITORY_OWNER:-}"
[BUILD_VAR_GITHUB_RUN_ID]="${GITHUB_RUN_ID:-}"
[BUILD_VAR_GITHUB_RUN_NUMBER]="${GITHUB_RUN_NUMBER:-}"
[BUILD_VAR_GITHUB_RUN_ATTEMPT]="${GITHUB_RUN_ATTEMPT:-}"
[BUILD_VAR_GITHUB_RETENTION_DAYS]="${GITHUB_RETENTION_DAYS:-}"
[BUILD_VAR_GITHUB_SERVER_URL]="${GITHUB_SERVER_URL:-}"
[BUILD_VAR_GITHUB_EVENT_NAME]="${GITHUB_EVENT_NAME:-}"
[BUILD_VAR_GITHUB_BASE_REF]="${GITHUB_BASE_REF:-}"
[BUILD_VAR_GITHUB_HEAD_REF]="${GITHUB_HEAD_REF:-}"
[BUILD_VAR_GITHUB_ACTION_REF]="${GITHUB_ACTION_REF:-}"
[BUILD_VAR_GITHUB_ACTION_REPOSITORY]="${GITHUB_ACTION_REPOSITORY:-}"
[BUILD_VAR_GITEA_ACTIONS_RUNNER_VERSION]="${GITEA_ACTIONS_RUNNER_VERSION:-}"
[BUILD_VAR_COMMIT_SHA_SHORT]="$SHA_SHORT"
[BUILD_VAR_BUILD_DATE]="$BUILD_DATE"
)
SED_ARGS=()
for key in "${!VARS[@]}"; do
SED_ARGS+=(-e "s|{{${key}}}|${VARS[$key]}|g")
done
grep -rIl --exclude-dir=.git '' . | xargs -r sed -i "${SED_ARGS[@]}"