78 lines
1.9 KiB
YAML
78 lines
1.9 KiB
YAML
name: Update Arch Repository
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'x86_64/*.pkg.tar.zst'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update-db:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gnupg libarchive-tools
|
|
|
|
- name: Import GPG Key
|
|
run: |
|
|
echo "${{ secrets.GPG_PRIVATE_KEY }}" > private.key
|
|
gpg --batch --import private.key
|
|
rm private.key
|
|
|
|
- name: Sign Packages
|
|
run: |
|
|
cd x86_64
|
|
|
|
for pkg in *.pkg.tar.zst; do
|
|
echo "Signing $pkg"
|
|
|
|
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes \
|
|
--pinentry-mode loopback \
|
|
--local-user 236328A7F2C2001E \
|
|
--passphrase-fd 0 \
|
|
--detach-sign "$pkg"
|
|
done
|
|
|
|
- name: Build Repo Database (correct Arch way)
|
|
run: |
|
|
cd x86_64
|
|
|
|
rm -f hyprarch-repo.db* hyprarch-repo.files*
|
|
|
|
repo-add --sign hyprarch-repo.db.tar.gz *.pkg.tar.zst
|
|
|
|
- name: Export Public Key
|
|
run: |
|
|
gpg --export --armor 236328A7F2C2001E > x86_64/pubkey.gpg
|
|
|
|
- name: Generate Simple Index Page
|
|
run: |
|
|
cd x86_64
|
|
|
|
echo "<html><body><h1>Repository Index</h1><ul>" > index.html
|
|
for file in *; do
|
|
echo "<li><a href='$file'>$file</a></li>" >> index.html
|
|
done
|
|
echo "</ul></body></html>" >> index.html
|
|
|
|
- name: Commit and Push
|
|
run: |
|
|
git config --global user.name "repo-bot"
|
|
git config --global user.email "repo-bot@users.noreply.github.com"
|
|
|
|
git add .
|
|
|
|
if ! git diff-index --quiet HEAD; then
|
|
git commit -m "Update repository database"
|
|
git push
|
|
else
|
|
echo "No changes"
|
|
fi |