fixing workflow now with signed gpg key :D
This commit is contained in:
38
.github/workflows/update-repo.yml
vendored
38
.github/workflows/update-repo.yml
vendored
@@ -17,38 +17,48 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup tools
|
- name: Setup tools
|
||||||
run: sudo apt-get update && sudo apt-get install -y libarchive-tools
|
run: sudo apt-get update && sudo apt-get install -y libarchive-tools gpg
|
||||||
|
|
||||||
|
- name: Import GPG Key
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import --batch
|
||||||
|
|
||||||
- name: Update Repository Database
|
- name: Update Repository Database
|
||||||
run: |
|
run: |
|
||||||
cd x86_64
|
cd x86_64
|
||||||
# Remove old DB files
|
# Remove old DB and sig files
|
||||||
rm -f hyprarch-repo.db hyprarch-repo.db.tar.gz hyprarch-repo.files hyprarch-repo.files.tar.gz
|
rm -f hyprarch-repo.db* hyprarch-repo.files*
|
||||||
|
|
||||||
# Create a temporary directory for metadata
|
|
||||||
mkdir -p db_temp
|
mkdir -p db_temp
|
||||||
|
|
||||||
# Extract metadata from each package and put it into the DB structure
|
|
||||||
for pkg in *.pkg.tar.zst; do
|
for pkg in *.pkg.tar.zst; do
|
||||||
|
# Sign the package if a signature doesn't exist
|
||||||
|
if [ ! -f "$pkg.sig" ]; then
|
||||||
|
gpg --detach-sign --batch --no-armor --local-user 236328A7F2C2001E "$pkg"
|
||||||
|
fi
|
||||||
|
|
||||||
pkgname=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgname =" | cut -d' ' -f3)
|
pkgname=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgname =" | cut -d' ' -f3)
|
||||||
pkgver=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgver =" | cut -d' ' -f3)
|
pkgver=$(bsdtar -xOf "$pkg" .PKGINFO | grep "^pkgver =" | cut -d' ' -f3)
|
||||||
mkdir -p "db_temp/$pkgname-$pkgver"
|
mkdir -p "db_temp/$pkgname-$pkgver"
|
||||||
bsdtar -xOf "$pkg" .PKGINFO > "db_temp/$pkgname-$pkgver/desc"
|
bsdtar -xOf "$pkg" .PKGINFO > "db_temp/$pkgname-$pkgver/desc"
|
||||||
# Add file size and build date to desc
|
|
||||||
echo -e "\n%FILENAME%\n$pkg" >> "db_temp/$pkgname-$pkgver/desc"
|
echo -e "\n%FILENAME%\n$pkg" >> "db_temp/$pkgname-$pkgver/desc"
|
||||||
echo -e "\n%CSIZE%\n$(stat -c%s "$pkg")" >> "db_temp/$pkgname-$pkgver/desc"
|
echo -e "\n%CSIZE%\n$(stat -c%s "$pkg")" >> "db_temp/$pkgname-$pkgver/desc"
|
||||||
|
echo -e "\n%PGPSIG%\n$(gpg --detach-sign --stdout --no-armor --local-user 236328A7F2C2001E "$pkg" | base64 | tr -d '\n')" >> "db_temp/$pkgname-$pkgver/desc"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Compress the metadata into a real Arch DB
|
|
||||||
cd db_temp
|
cd db_temp
|
||||||
tar -c * | gzip -9 > ../hyprarch-repo.db.tar.gz
|
tar -c * | gzip -9 > ../hyprarch-repo.db.tar.gz
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf db_temp
|
|
||||||
|
# Sign the database itself
|
||||||
# Create the required symlinks/copies for GitHub Pages
|
gpg --detach-sign --batch --no-armor --local-user 236328A7F2C2001E hyprarch-repo.db.tar.gz
|
||||||
|
|
||||||
|
# Finalize files
|
||||||
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
|
||||||
|
cp hyprarch-repo.db.tar.gz.sig hyprarch-repo.db.sig
|
||||||
cp hyprarch-repo.db.tar.gz hyprarch-repo.files
|
cp hyprarch-repo.db.tar.gz hyprarch-repo.files
|
||||||
cp hyprarch-repo.db.tar.gz hyprarch-repo.files.tar.gz
|
rm -rf db_temp
|
||||||
|
|
||||||
- name: Generate Subfolder Index
|
- name: Generate Subfolder Index
|
||||||
run: |
|
run: |
|
||||||
@@ -57,7 +67,7 @@ jobs:
|
|||||||
echo "<h1>Index of /x86_64/</h1><hr><pre>" >> index.html
|
echo "<h1>Index of /x86_64/</h1><hr><pre>" >> index.html
|
||||||
echo "<a href='../'>../</a>" >> index.html
|
echo "<a href='../'>../</a>" >> index.html
|
||||||
for file in *; do
|
for file in *; do
|
||||||
if [ "$file" != "index.html" ]; then
|
if [[ "$file" != "index.html" ]]; then
|
||||||
size=$(du -sh "$file" | cut -f1)
|
size=$(du -sh "$file" | cut -f1)
|
||||||
date=$(date -r "$file" '+%d-%b-%Y %H:%M')
|
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
|
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
|
||||||
@@ -85,7 +95,7 @@ jobs:
|
|||||||
<h1>🚀 HyprArch Custom Repository</h1>
|
<h1>🚀 HyprArch Custom Repository</h1>
|
||||||
<p>To use this repository, add the following to your <code>/etc/pacman.conf</code>:</p>
|
<p>To use this repository, add the following to your <code>/etc/pacman.conf</code>:</p>
|
||||||
<pre>[hyprarch-repo]
|
<pre>[hyprarch-repo]
|
||||||
SigLevel = Optional TrustAll
|
SigLevel = Required DatabaseOptional
|
||||||
Server = https://hyprarch-repo.stuple.net/$arch</pre>
|
Server = https://hyprarch-repo.stuple.net/$arch</pre>
|
||||||
|
|
||||||
<h2>📦 Available Packages</h2>
|
<h2>📦 Available Packages</h2>
|
||||||
@@ -104,7 +114,7 @@ jobs:
|
|||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add .
|
git add .
|
||||||
if ! git diff-index --quiet HEAD; then
|
if ! git diff-index --quiet HEAD; then
|
||||||
git commit -m "Manual DB generation and fixed indices"
|
git commit -m "Signed database and packages with GPG 236328A7F2C2001E"
|
||||||
git push
|
git push
|
||||||
else
|
else
|
||||||
echo "Nothing to change."
|
echo "Nothing to change."
|
||||||
|
|||||||
Reference in New Issue
Block a user