diff --git a/.github/workflows/update-repo.yml b/.github/workflows/update-repo.yml index b9a81ff..0f53f95 100644 --- a/.github/workflows/update-repo.yml +++ b/.github/workflows/update-repo.yml @@ -17,68 +17,50 @@ jobs: fetch-depth: 0 - name: Setup tools - run: | - sudo apt-get update - sudo apt-get install -y libarchive-tools # Provides bsdtar + run: sudo apt-get update && sudo apt-get install -y libarchive-tools - 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 + # Rebuild the DB (Manual tar to ensure compatibility) + tar -cvzf hyprarch-repo.db.tar.gz *.pkg.tar.zst + + # Fix 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 - - name: Generate Package Index - run: | - echo "

Package Index

" >> index.html - - - name: Generate Python-Style Index + - name: Generate Python-style Index run: | + # 1. Create index for x86_64 folder cd x86_64 - # Start the HTML file echo "Index of /x86_64/" > index.html echo "

Index of /x86_64/


" >> index.html
-          
-          # Add the 'Parent Directory' link
           echo "../" >> index.html
-          
-          # Loop through every file in the folder and make a link
           for file in *; do
-            # Don't list the index.html file itself
             if [ "$file" != "index.html" ]; then
-              # Get file size for that authentic look (optional)
               size=$(du -sh "$file" | cut -f1)
-              echo "$file                     $(date -r "$file" '+%d-%b-%Y %H:%M')    $size" >> index.html
+              date=$(date -r "$file" '+%d-%b-%Y %H:%M')
+              echo "$file$(printf '%*s' $((50 - ${#file})) '') $date    $size" >> index.html
             fi
           done
+          echo "

" >> index.html + # 2. Create index for the Root folder + cd .. + echo "Index of /" > index.html + echo "

Index of /


" >> index.html
+          echo "x86_64/" >> index.html
           echo "

" >> index.html - 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/ + git add . if ! git diff-index --quiet HEAD; then - git commit -m "Automated database update" + git commit -m "Automated database and index update" git push else - echo "Nothing to commit." + echo "Nothing to change." fi