name: Update pacman repo DB (repo-add) on: push: tags: - "v*" - "vrepo-*" workflow_dispatch: jobs: repoadd: runs-on: iso-builder steps: - name: Checkout repository via SSH run: | git clone --depth 1 git@git.rp1.hu:RaveOS/raveos-core-repo.git "${GITHUB_WORKSPACE}" - name: Install repo-add (pacman-contrib) run: | set -euo pipefail sudo pacman -S --needed --noconfirm pacman-contrib - name: Rebuild repo DB files run: | set -euo pipefail REPO_NAME="raveos-core-repo" if [ ! -d "x86_64" ]; then echo "ERROR: x86_64 directory not found!" exit 1 fi cd x86_64 rm -f "${REPO_NAME}.db" \ "${REPO_NAME}.files" \ "${REPO_NAME}.db.tar.xz" \ "${REPO_NAME}.files.tar.xz" \ "${REPO_NAME}.db.tar.xz.old" \ "${REPO_NAME}.files.tar.xz.old" || true repo-add "${REPO_NAME}.db.tar.xz" ./*.pkg.tar.zst ln -sf "${REPO_NAME}.db.tar.xz" "${REPO_NAME}.db" ln -sf "${REPO_NAME}.files.tar.xz" "${REPO_NAME}.files" echo "=== DB files created ===" ls -la | grep -E "${REPO_NAME}\.(db|files)" - name: Commit and push updated DB files (to main) run: | set -euo pipefail cd "${GITHUB_WORKSPACE}" git config user.name "Forgejo Actions" git config user.email "actions@forgejo.local" git fetch origin main git checkout -B main origin/main git add x86_64/raveos-core-repo.db* x86_64/raveos-core-repo.files* || true if git diff --staged --quiet; then echo "No DB changes, nothing to commit." exit 0 fi git commit -m "Update pacman repo DB (repo-add)" git push origin main - name: Cleanup old tags (keep last 5) run: | cd "${GITHUB_WORKSPACE}" git fetch --tags OLD_TAGS=$(git tag --sort=-creatordate | tail -n +6) if [ -z "$OLD_TAGS" ]; then echo "Nincs torlendo tag." else echo "$OLD_TAGS" | while read -r tag; do git push origin --delete "$tag" && echo "Tag torolve: $tag" || echo "Tag torles sikertelen: $tag" done fi - name: Cleanup if: always() run: | sudo rm -rf /var/cache/pacman/pkg/* || true df -h