From b31cb55539c549ffee2b6473e85a6e84716d4954 Mon Sep 17 00:00:00 2001 From: fithwum Date: Sat, 20 Dec 2025 15:49:07 -0800 Subject: [PATCH] test --- .gitea/workflows/base-build.yml | 42 ++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/base-build.yml b/.gitea/workflows/base-build.yml index ccf93b3..ec35c59 100644 --- a/.gitea/workflows/base-build.yml +++ b/.gitea/workflows/base-build.yml @@ -214,29 +214,43 @@ jobs: # Add new sha256 sha256sum "$TAR" >> sha256sums.txt - - name: Commit and push if changed + - name: Commit and push if changed (matrix-safe) id: commit_archives run: | cd upload-repo - git config --global user.name "${{ env.GIT_USERNAME }}" - git config --global user.email "${{ env.GIT_EMAIL }}" + git config user.name "${{ env.GIT_USERNAME }}" + git config user.email "${{ env.GIT_EMAIL }}" - if git status --porcelain | grep .; then - git add **/*.tar.bz2 sha256sums.txt - git commit -m "Update base images and checksum for ${{ matrix.version }} on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]" + # Create temporary branch for this version + TEMP_BRANCH="tmp-update-${{ matrix.version }}-$(date -u +%s)" + git checkout -b "$TEMP_BRANCH" - # Fetch latest changes and rebase local commits on top - git pull --rebase origin main || true + # Stage changes + git add **/*.tar.bz2 sha256sums.txt - # Push after rebase - git push origin main - - echo "archives_changed=true" >> $GITEA_OUTPUT - else - echo "[INFO] No changes to commit." + if git diff --cached --quiet; then + echo "[INFO] No changes to commit for ${{ matrix.version }}" echo "archives_changed=false" >> $GITEA_OUTPUT + exit 0 fi + git commit -m "Update base image and checksum for ${{ matrix.version }} on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]" + + # Push temporary branch + git push origin "$TEMP_BRANCH" + + # Merge temp branch into main safely + git checkout main + git fetch origin main + git merge --no-ff --no-edit "$TEMP_BRANCH" + + # Push main + git push origin main + + # Delete temporary branch on remote + git push origin --delete "$TEMP_BRANCH" || true + echo "archives_changed=true" >> $GITEA_OUTPUT + # build-and-push-docker-images: # needs: # - docker-prune