diff --git a/.gitea/workflows/base-build.yml b/.gitea/workflows/base-build.yml index 2b0aa05..4aa5f78 100644 --- a/.gitea/workflows/base-build.yml +++ b/.gitea/workflows/base-build.yml @@ -133,32 +133,39 @@ jobs: git config user.name "${{ env.GIT_USERNAME }}" git config user.email "${{ env.GIT_EMAIL }}" - TEMP_BRANCH="tmp-update-${{ matrix.version }}-$(date -u +%s)" + VERSION=${{ matrix.version }} + TEMP_BRANCH="tmp-update-$VERSION-$(date -u +%s)" + + # Create temporary branch git checkout -b "$TEMP_BRANCH" + # Stage only this version's files git add "$VERSION/debian-$VERSION.tar.bz2" "$VERSION/sha256sums.txt" + # Check if anything changed if git diff --cached --quiet; then - echo "[INFO] No changes to commit for ${{ matrix.version }}" + echo "[INFO] No changes to commit for $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]" + git commit -m "Update base image and checksum for $VERSION on $(date -u +'%Y-%m-%dT%H:%M:%SZ') [skip ci]" - # Push temporary branch + # Push temp branch to remote git push origin "$TEMP_BRANCH" - # Merge temp branch into main safely + # Switch back to main and rebase onto remote main git checkout main git fetch origin main git rebase origin/main + + # Merge temp branch git merge --no-ff --no-edit "$TEMP_BRANCH" - # Push main + # Push main safely git push origin main - # Delete temporary branch on remote + # Delete temporary branch git push origin --delete "$TEMP_BRANCH" || true echo "archives_changed=true" >> $GITEA_OUTPUT