Files
hyprarch-repo/.github/workflows/update-repo.yml

59 lines
1.7 KiB
YAML

name: Update Arch Repository
on:
push:
paths:
- 'x86_64/*.pkg.tar.zst'
workflow_dispatch:
jobs:
update-db:
runs-on: ubuntu-latest
container:
image: archlinux:latest
options: --user root # Ensure we are running as root to match container ownership
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
pacman -Sy --noconfirm pacman git
- name: Fix Git Ownership
run: |
# This tells Git to ignore ownership checks for every folder on this runner
git config --global --add safe.directory '*'
- 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
# Break symlinks for GitHub Pages
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: |
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