diff --git a/.gitea/workflows/base-build.yml b/.gitea/workflows/base-build.yml index 4165a6a..fb74571 100644 --- a/.gitea/workflows/base-build.yml +++ b/.gitea/workflows/base-build.yml @@ -47,28 +47,33 @@ jobs: git clone "$REPO_URL" upload-repo + # Clean old archives mkdir -p upload-repo/${{ matrix.version }} find upload-repo/${{ matrix.version }} -name '*.tar.bz2' -type f -delete - # Clean old tarballs - for version_dir in bookworm bullseye buster docker-build; do - find upload-repo/"$version_dir" -name '*.tar.bz2' -type f -delete || true + # Find and copy archives + found=$(find . -name '*.tar.bz2') + if [ -n "$found" ]; then + for filepath in $found; do + version_dir=$(dirname "$filepath") + mkdir -p upload-repo/"$version_dir" + cp "$filepath" upload-repo/"$version_dir"/ done - # Find all tarballs recursively in the workspace - found=$(find . -name '*.tar.bz2') + # Debug list to verify files copied + ls -lR upload-repo - if [ -n "$found" ]; then - for filepath in $found; do - version_dir=$(dirname "$filepath") - mkdir -p "upload-repo/$version_dir" - cp "$filepath" "upload-repo/$version_dir/" - done + cd upload-repo - cd upload-repo - git add **/*.tar.bz2 + git add **/*.tar.bz2 + + if git diff --cached --quiet; then + echo "[INFO] No changes to commit." + else git commit -m "Update base images on $(date -u +'%Y-%m-%dT%H:%M:%SZ')" git push + fi + else echo "[WARNING] No .tar.bz2 archive found in workspace!" exit 1