54 lines
1.5 KiB
YAML
54 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 tools
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libarchive-tools # Provides bsdtar
|
|
|
|
- name: Update Repository Database
|
|
run: |
|
|
cd x86_64
|
|
if ls *.pkg.tar.zst 1> /dev/null 2>&1; then
|
|
echo "Building database files..."
|
|
# Using bsdtar to create the db manually if repo-add fails on Ubuntu
|
|
# This is a safe fallback for custom repos
|
|
tar -cvzf hyprarch-repo.db.tar.gz *.pkg.tar.zst
|
|
|
|
# Create the standalone files for GitHub Pages
|
|
rm -f hyprarch-repo.db hyprarch-repo.files
|
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
|
|
echo "Database updated successfully."
|
|
else
|
|
echo "No packages found in x86_64/."
|
|
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
|