diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index 47073d6..2bf286d 100644 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -371,11 +371,27 @@ jobs: run: | git config --local user.email "action@pi-farm.de" git config --local user.name "Gitea Action" + + # Sicherstellen, dass wir etwas zum Committen haben git add VERSION.history README.md docker-compose.yml + + # Nur committen, wenn es Änderungen gibt git diff --quiet && git diff --staged --quiet || git commit -m "${{ env.FINAL_MSG }} [skip ci]" - git tag -f "v${{ steps.prep.outputs.docker_tag }}" - git push origin main - git push -f origin "v${{ steps.prep.outputs.docker_tag }}" + + # Das Tag exakt so setzen, wie es in prep definiert wurde (ohne extra 'v') + TARGET_TAG="${{ steps.prep.outputs.docker_tag }}" + git tag -f "$TARGET_TAG" + + if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then + echo "🏷️ Build aus Tag getriggert: $TARGET_TAG" + # Wir pushen das Tag (force), um die Doku-Updates einzuschließen + git push -f origin "$TARGET_TAG" + else + echo "🌿 Build aus Branch/Schedule getriggert: ${{ gitea.ref_name }}" + # In den Branch pushen (HEAD:branch_name) und das Tag setzen + git push origin HEAD:${{ gitea.ref_name }} + git push -f origin "$TARGET_TAG" + fi - name: Cleanup Temporary Tags on Docker Hub if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub')