feat: make docker-push workflow self-contained by computing deps_hash internally

This commit is contained in:
2026-04-09 10:20:11 +02:00
parent 4559ea3b82
commit 1cd3235404
2 changed files with 12 additions and 8 deletions

View File

@@ -323,5 +323,5 @@ jobs:
-H "Authorization: token ${{ secrets.GITEA_TOKEN || secrets.PACKAGES_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN || secrets.PACKAGES_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
"${{ env.GITEA_INTERNAL }}api/v1/repos/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}/actions/workflows/docker-push.yaml/dispatches" \ "${{ env.GITEA_INTERNAL }}api/v1/repos/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}/actions/workflows/docker-push.yaml/dispatches" \
-d '{"ref":"${{ github.ref }}","inputs":{"deps_hash":"${{ needs.build-cache.outputs.deps_hash }}","ref":"${{ github.ref }}"}}' -d '{"ref":"${{ github.ref }}"}'
echo "✅ Docker Push workflow triggered successfully!" echo "✅ Docker Push workflow triggered successfully!"

View File

@@ -6,13 +6,9 @@
name: Docker Push name: Docker Push
on: on:
# Manual trigger only - no automatic triggers # Manual trigger for testing or production
workflow_dispatch: workflow_dispatch:
inputs: inputs:
deps_hash:
description: 'Dependency hash from build-cache job'
required: true
type: string
ref: ref:
description: 'Git reference (branch/tag)' description: 'Git reference (branch/tag)'
required: false required: false
@@ -45,13 +41,21 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.PACKAGES_TOKEN }} password: ${{ secrets.PACKAGES_TOKEN }}
- name: Calculate dependency hash
id: calc_hash
run: |
# Calculate dependency hash (same method as build-cache job)
DEPS_HASH=$(sha256sum go.mod go.sum docker/Dockerfile.build | sha256sum | cut -d' ' -f1 | head -c 12)
echo "Dependency hash: $DEPS_HASH"
echo "deps_hash=$DEPS_HASH" >> $GITHUB_OUTPUT
- name: Build and push Docker image - name: Build and push Docker image
run: | run: |
source VERSION source VERSION
IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}"
# Use the provided dependency hash # Use the calculated dependency hash
DEPS_HASH="${{ github.event.inputs.deps_hash }}" DEPS_HASH="${{ steps.calc_hash.outputs.deps_hash }}"
echo "Using dependency hash: $DEPS_HASH" echo "Using dependency hash: $DEPS_HASH"
# Create Dockerfile.prod from template # Create Dockerfile.prod from template