name: Update Arch Repository (Host stui) on: push: paths: - 'x86_64/*.pkg.tar.zst' workflow_dispatch: jobs: build-and-deploy: runs-on: local # Ensure your runner has the 'local:host' label steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Import GPG Key run: | echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import --yes - name: Build and Sign Repository run: | cd x86_64 # Remove old database files rm -f hyprarch-repo.db* hyprarch-repo.files* mkdir -p db_temp # Export public key for landing page gpg --export --armor 236328A7F2C2001E > pubkey.gpg for pkg in *.pkg.tar.zst; do # 1. Create BINARY detached signature echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --local-user 236328A7F2C2001E --passphrase-fd 0 --detach-sign --output "$pkg.sig" "$pkg" # 2. Extract Metadata safely pkgname=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgname =" | cut -d' ' -f3 | tr -d '\r') pkgver=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgver =" | cut -d' ' -f3 | tr -d '\r') pkgdesc=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgdesc =" | cut -d' ' -f3- | sed "s/['\"]//g" | tr -d '\r') pkgsize=$(stat -c%s "$pkg") instsize=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^size =" | cut -d' ' -f3 | tr -d '\r') mkdir -p "db_temp/$pkgname-$pkgver" { echo "%NAME%"; echo "$pkgname"; echo "" echo "%VERSION%"; echo "$pkgver"; echo "" echo "%DESC%"; echo "$pkgdesc"; echo "" echo "%FILENAME%"; echo "$pkg"; echo "" echo "%CSIZE%"; echo "$pkgsize"; echo "" echo "%ISIZE%"; echo "$instsize"; echo "" echo "%PGPSIG%" base64 -w 0 "$pkg.sig" echo "" echo "" } > "db_temp/$pkgname-$pkgver/desc" done # 3. Pack the Database cd db_temp tar --owner=0 --group=0 -c * | gzip -n -9 > ../hyprarch-repo.db.tar.gz cd .. # 4. Sign and Finalize Database cp hyprarch-repo.db.tar.gz hyprarch-repo.db cp hyprarch-repo.db.tar.gz hyprarch-repo.files echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --local-user 236328A7F2C2001E --passphrase-fd 0 --detach-sign --output hyprarch-repo.db.sig hyprarch-repo.db rm -rf db_temp - name: Generate Subfolder Index run: | cd x86_64 echo "
" >> index.html
echo "../" >> 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 "Run this command to trust the repository maintainer (Mitsuba100):
curl -s https://repo.stuple.net/x86_64/pubkey.gpg | sudo pacman-key -a - && sudo pacman-key --lsign-key 236328A7F2C2001E
Add the following to the bottom of /etc/pacman.conf:
[hyprarch-repo]
SigLevel = Required DatabaseOptional
Server = https://repo.stuple.net/\$arch
sudo pacman -Sy
Automated by GitHub Actions • Last updated: '$(date)'