Build and Push Packages #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Packages | |
on: | |
schedule: | |
- cron: '22 5 * * 0' | |
workflow_dispatch: | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
container: | |
image: athenaos/base-devel:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Remove problematic mirrors | |
run: | | |
sed -i "/arch.mirror.constant.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/us.leaseweb.net/d" /etc/pacman.d/mirrorlist | |
sed -i "/america.mirror.pkgbuild.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/geo.mirror.pkgbuild.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/london.mirror.pkgbuild.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/geo-mirror.chaotic.cx/d" /etc/pacman.d/chaotic-mirrorlist | |
sed -i "/iad-us-mirror.silky.network/d" /etc/pacman.d/mirrorlist | |
sed -i "/archlinux.uk.mirror.allworldit.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.lty.me/d" /etc/pacman.d/mirrorlist | |
sed -i "/archlinux.mailtunnel.eu/d" /etc/pacman.d/mirrorlist | |
sed -i "/pkg.fef.moe/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.cyberbits.eu/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.fra10.de.leaseweb.net/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.ubrco.de/d" /etc/pacman.d/mirrorlist | |
sed -i "/europe.mirror.pkgbuild.com/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.sunred.org/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirror.netcologne.de/d" /etc/pacman.d/mirrorlist | |
sed -i "/mirrors.eze.sysarmy.com/d" /etc/pacman.d/mirrorlist | |
- name: Init Keys | |
run: | | |
rm -rf /etc/pacman.d/gnupg | |
pacman-key --init | |
pacman-key --populate | |
pacman -Syy | |
- name: Install dependencies | |
run: pacman -Syyu --noconfirm git gtk-update-icon-cache kservice5 openssh pacman-contrib rate-mirrors rsync sshpass | |
- name: Setting builder user | |
run: | | |
useradd -m -d /src -G wheel -g users builder -s /bin/bash | |
echo "builder ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers | |
echo "root ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers | |
chmod -R a+rw . | |
chown -R builder . | |
chown -R builder /github/home | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PACKAGE_SIGNING_PASSPHRASE }} | |
- name: Set fastest mirrors | |
run: | | |
rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/mirrorlist arch | |
rate-mirrors --concurrency 40 --disable-comments --allow-root --save /etc/pacman.d/chaotic-mirrorlist chaotic-aur | |
- name: Build and push | |
run: | | |
export PASSPHRASE=${{ secrets.PACKAGE_SIGNING_PASSPHRASE }} | |
chmod +x ./scripts/build-and-sign-packages.sh | |
chown -R builder ~/.gnupg/ | |
paths=("$(pwd)/packages/applications" "$(pwd)/packages/configuration" "$(pwd)/packages/desktops" "$(pwd)/packages/displaymanagers" "$(pwd)/packages/environments" "$(pwd)/packages/misc" "$(pwd)/packages/os-specific" "$(pwd)/packages/pentesting") | |
# Loop through paths and run the command | |
for path in "${paths[@]}"; do | |
rm -rf *.zst* | |
sudo -E -u builder $(pwd)/scripts/build-and-sign-packages.sh -p "$path" | |
rm -rf /tmp/makepkg | |
yes | pacman -Scc | |
repo-add --verify --sign -R athena.db.tar.gz *.pkg.tar.zst | |
sshpass -p "${{ secrets.MIRROR_SECRET }}" rsync -avzzlr --delete -e "ssh -p 1027 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" *tar.zst *tar.zst.sig *.db *.db.sig *.db.tar.gz *.db.tar.gz.sig *.files *.files.sig *.files.tar.gz *.files.tar.gz.sig ${{ secrets.MIRROR_USER }}@hub.athenaos.org:/srv/mirrors/athena/ | |
done |