name: Update Arch Repository on: push: paths: - 'x86_64/*.pkg.tar.zst' workflow_dispatch: jobs: build-and-deploy: runs-on: local steps: - name: Checkout code uses: actions/checkout@v4 - name: Import GPG Key run: | echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import --yes - name: Build and Sign Repository run: | cd x86_64 rm -f hyprarch-repo.db* hyprarch-repo.files* *.sig # Export public key for users gpg --export --armor 236328A7F2C2001E > pubkey.gpg # Sign all packages for pkg in *.pkg.tar.zst; do echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback \ --local-user 236328A7F2C2001E --passphrase-fd 0 \ --detach-sign "$pkg" done # Build the database via Python script on the Pi python3 ~/build_db.py # Sign the database file echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback \ --local-user 236328A7F2C2001E --passphrase-fd 0 \ --detach-sign hyprarch-repo.db # Mirror sig for compatibility cp hyprarch-repo.db.sig hyprarch-repo.db.tar.gz.sig - name: Generate Subfolder Index run: | cd x86_64 echo "Index of /x86_64/" > index.html echo "

Index of /x86_64/


../" >> index.html
          for file in *; do
            if [[ "$file" != "index.html" ]]; then
              size=$(du -sh "$file" | cut -f1)
              date=$(date -r "$file" '+%d-%b-%Y %H:%M')
              printf "%s%-$(($(printf '%s' "$file" | wc -c) > 50 ? 1 : 50 - $(printf '%s' "$file" | wc -c)))s %s %8s\n" "$file" "$file" "" "$date" "$size" >> index.html
            fi
          done
          echo "

" >> index.html - name: Generate Root Landing Page run: | cat <<'EOF' > index.html HyprArch Repository

🚀 HyprArch Custom Repository

Welcome to the official HyprArch repository maintained by Stuart Drew (Mitsuba100).

1. Add the GPG Key

Import and locally sign the key to trust these packages:

curl -s https://repo.stuple.net/x86_64/pubkey.gpg | sudo pacman-key -a - && sudo pacman-key --lsign-key 236328A7F2C2001E

2. Configure Pacman

Add the following to the bottom of /etc/pacman.conf:

[hyprarch-repo]
SigLevel = Required DatabaseOptional
Server = https://repo.stuple.net/$arch

3. Sync & Install

sudo pacman -Sy && sudo pacman -S HyprArch-waybar
EOF # Now we safely inject the dynamic date into the static HTML file sed -i "s|Automated by GitHub Actions|& • Last updated: $(date)|" index.html - name: Deploy and Fix Permissions run: | sudo mkdir -p /var/www/hyprarch-repo/x86_64 sudo cp -rf . /var/www/hyprarch-repo/ sudo chown -R stui:www-data /var/www/hyprarch-repo sudo chmod -R 755 /var/www/hyprarch-repo