113 lines
4.7 KiB
YAML
113 lines
4.7 KiB
YAML
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
|
|
|
|
gpg --export --armor 236328A7F2C2001E > pubkey.gpg
|
|
|
|
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
|
|
|
|
python3 ~/build_db.py
|
|
|
|
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback \
|
|
--local-user 236328A7F2C2001E --passphrase-fd 0 \
|
|
--detach-sign hyprarch-repo.db
|
|
|
|
cp hyprarch-repo.db.sig hyprarch-repo.db.tar.gz.sig
|
|
|
|
- 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><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 Repository</title>
|
|
<style>
|
|
body { font-family: sans-serif; margin: 40px; line-height: 1.6; background: #2e3440; color: #eceff4; }
|
|
a { color: #88c0d0; text-decoration: none; }
|
|
.container { max-width: 900px; margin: auto; background: #3b4252; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
|
|
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; }
|
|
footer { margin-top: 40px; border-top: 1px solid #4c566a; padding-top: 20px; font-size: 0.9em; opacity: 0.8; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>HyprArch Custom Repository</h1>
|
|
<p>Welcome to the official <strong>HyprArch</strong> repository maintained by <strong>Stuart Drew</strong>.</p>
|
|
|
|
<h2>1. Add the GPG Key</h2>
|
|
<pre>curl -s https://hyprarch-repo.stuple.net/x86_64/pubkey.gpg | sudo pacman-key -a - && sudo pacman-key --lsign-key 236328A7F2C2001E</pre>
|
|
|
|
<h2>2. Configure Pacman</h2>
|
|
<pre>[hyprarch-repo]
|
|
SigLevel = Required DatabaseOptional
|
|
Server = https://hyprarch-repo.stuple.net/$arch</pre>
|
|
|
|
<footer>
|
|
<p><a href="./x86_64/">Browse File Index</a></p>
|
|
<p id="status-tag">Automated by GitHub Actions</p>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
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
|
|
- name: Push to Gitea
|
|
run: |
|
|
git config --global user.name "GitHub Actions"
|
|
git config --global user.email "actions@github.com"
|
|
git add .
|
|
if git diff --staged --quiet; then
|
|
echo "No changes to commit."
|
|
else
|
|
git commit -m "Automated repo update: $(date)"
|
|
# Note: Mitsuba100 is used here as the user; adjust if the Gitea repo owner is different.
|
|
git push https://Mitsuba100:${{ secrets.GITEAPAT }}@git.stuple.net/Stuple-Networks/hyprarch-repo.git main
|
|
fi |