Update .github/workflows/update-repo.yml

This commit is contained in:
2026-04-14 21:29:00 +02:00
parent 521b2ad8e7
commit bb0306278d

View File

@@ -1,4 +1,4 @@
name: Update Arch Repository
name: Update Arch Repository (Host stui)
on:
push:
@@ -13,6 +13,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Import GPG Key
run: |
@@ -21,16 +23,18 @@ jobs:
- 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
# Create BINARY detached signature
# 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"
# Extract Metadata
# 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')
@@ -38,7 +42,6 @@ jobs:
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 ""
@@ -53,36 +56,73 @@ jobs:
} > "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 Landing Page
- name: Generate Subfolder Index
run: |
cd x86_64
echo "<html><head><title>Index of /x86_64/</title></head><body style='font-family: monospace;'>" > index.html
echo "<h1>Index of /x86_64/</h1><hr><pre>" >> index.html
echo "<a href='../'>../</a>" >> 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 "<a href='%s'>%s</a>%-$(($(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 "</pre><hr></body></html>" >> index.html
- name: Generate Root Landing Page
run: |
cat <<EOF > index.html
<!DOCTYPE html>
<html>
<head>
<title>HyprArch Repo</title>
<title>HyprArch Repository</title>
<style>
body { font-family: sans-serif; background: #2e3440; color: #eceff4; padding: 40px; }
.container { max-width: 800px; margin: auto; background: #3b4252; padding: 30px; border-radius: 10px; }
pre { background: #2e3440; padding: 15px; border-radius: 5px; color: #ebcb8b; }
a { color: #88c0d0; }
body { font-family: sans-serif; margin: 40px; line-height: 1.6; background: #2e3440; color: #eceff4; }
a { color: #88c0d0; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 900px; margin: auto; background: #3b4252; padding: 20px; border-radius: 8px; }
h1 { border-bottom: 2px solid #4c566a; padding-bottom: 10px; color: #81a1c1; }
h2 { color: #a3be8c; margin-top: 30px; }
pre { background: #2e3440; padding: 15px; border-radius: 5px; color: #ebcb8b; overflow-x: auto; border: 1px solid #4c566a; }
code { color: #d08770; }
.step { background: #434c5e; padding: 10px 15px; border-left: 4px solid #81a1c1; margin: 10px 0; }
</style>
</head>
<body>
<div class="container">
<h1>🚀 HyprArch Pi Repository</h1>
<h1>🚀 HyprArch Custom Repository</h1>
<h2>1. Add the GPG Key</h2>
<p>Run this command to trust the repository maintainer (Mitsuba100):</p>
<pre>curl -s https://repo.stuple.net/x86_64/pubkey.gpg | sudo pacman-key -a - && sudo pacman-key --lsign-key 236328A7F2C2001E</pre>
<h2>2. Configure Pacman</h2>
<p>Add the following to the bottom of <code>/etc/pacman.conf</code>:</p>
<pre>[hyprarch-repo]
SigLevel = Required DatabaseOptional
Server = https://repo.stuple.net/\$arch</pre>
<p><a href="./x86_64/">📂 Browse File Index</a></p>
<h2>3. Sync</h2>
<div class="step">
<code>sudo pacman -Sy</code>
</div>
<hr style="margin-top:40px; border: 0; border-top: 1px solid #4c566a;">
<p><a href="./x86_64/">📁 Browse File Index</a></p>
<p><small>Automated by GitHub Actions • Last updated: '$(date)'</small></p>
</div>
</body>
</html>
@@ -90,6 +130,6 @@ jobs:
- name: Deploy to Local Web Folder
run: |
# Since stui now owns the folder, we don't need sudo here
# Use your correct repo path and ensure stui has write access to it
mkdir -p /var/www/hyprarch-repo/x86_64
cp -rf . /var/www/hyprarch-repo/