fixing workflow 2
This commit is contained in:
16
.github/workflows/update-repo.yml
vendored
16
.github/workflows/update-repo.yml
vendored
@@ -12,43 +12,47 @@ jobs:
|
||||
container: archlinux:latest
|
||||
|
||||
steps:
|
||||
# Step 1: Actually download the code so it IS a git repo
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Step 2: Install tools
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
pacman -Sy --noconfirm pacman git
|
||||
|
||||
# Step 3: Run the database update
|
||||
- name: Update Repository Database
|
||||
run: |
|
||||
# Tell git to trust the directory immediately
|
||||
git config --global --add safe.directory /__w/hyprarch-repo/hyprarch-repo
|
||||
|
||||
cd x86_64
|
||||
# Check if any .zst files exist before running repo-add
|
||||
if ls *.pkg.tar.zst 1> /dev/null 2>&1; then
|
||||
echo "Packages found. Updating database..."
|
||||
repo-add hyprarch-repo.db.tar.gz *.pkg.tar.zst
|
||||
|
||||
# Fix symlinks for GitHub Pages
|
||||
# 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 .pkg.tar.zst files found. Skipping database update."
|
||||
echo "No .pkg.tar.zst files found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 4: Push back to the repo
|
||||
- name: Commit and Push changes
|
||||
run: |
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add x86_64/
|
||||
# Only push if there's actually a new database to upload
|
||||
if ! git diff-index --quiet HEAD; then
|
||||
git commit -m "Automated database update"
|
||||
git push
|
||||
else
|
||||
echo "Nothing to commit."
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user