Files
hyprarch-repo/.github/workflows/update-repo.yml
2026-03-11 16:28:48 +01:00

52 lines
1.5 KiB
YAML

name: Update Arch Repository
on:
push:
paths:
- 'x86_64/*.pkg.tar.zst'
workflow_dispatch:
jobs:
update-db:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup repo-add tools
run: |
sudo apt-get update && sudo apt-get install -y bsdtar
curl -L https://gitlab.archlinux.org/pacman/pacman/-/raw/master/scripts/repo-add.sh.in -o repo-add
chmod +x repo-add
sed -i 's|@pkgdatadir@|/usr/share/pacman|g' repo-add
- name: Update Repository Database
run: |
cd x86_64
if ls *.pkg.tar.zst 1> /dev/null 2>&1; then
echo "Updating database..."
../repo-add hyprarch-repo.db.tar.gz *.pkg.tar.zst
rm -f hyprarch-repo.db hyprarch-repo.files
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
cp hyprarch-repo.files.tar.gz hyprarch-repo.files
else
echo "No packages found."
exit 1
fi
- name: Commit and Push changes
run: |
cd "$GITHUB_WORKSPACE" # Fix: return to repo root!
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add x86_64/
if ! git diff-index --quiet HEAD; then
git commit -m "Automated database update"
git push
else
echo "Nothing to commit."
fi