Skip to content

Build and Push Packages #8

Build and Push Packages

Build and Push Packages #8

Workflow file for this run

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 sign packages
run: |
export PASSPHRASE=${{ secrets.PACKAGE_SIGNING_PASSPHRASE }}
chmod +x ./scripts/build-and-sign-packages.sh
chown -R builder ~/.gnupg/
sudo -E -u builder ./scripts/build-and-sign-packages.sh
- name: Push packages to another repository
run: |
rm -rf /tmp/makepkg
rm -rf "$AGENT_TOOLSDIRECTORY"
yes | pacman -Scc
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git clone https://github.com/Athena-OS/athena-repository.git
for newpkg in *.pkg.tar.zst
do
basefilename=$(basename "$newpkg" | sed 's/-[0-9].*//')
rm -rf ./athena-repository/x86_64/"$basefilename"*.zst
cp -rf "$newpkg" ./athena-repository/x86_64/
done
for newpkg in *.pkg.tar.zst.sig
do
basefilename=$(basename "$newpkg" | sed 's/-[0-9].*//')
rm -rf ./athena-repository/x86_64/"$basefilename"*.zst.sig
cp -rf "$newpkg" ./athena-repository/x86_64/
done
cd athena-repository
./update-database.sh
git add --all
git commit -m "Add built packages"
git push https://D3vil0p3r:${{ secrets.DESTINATION_REPO_TOKEN }}@github.com/Athena-OS/athena-repository.git main
sshpass -p "${{ secrets.MIRROR_SECRET }}" rsync -avzzlr --delete -e "ssh -p 1027 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" x86_64 ${{ secrets.MIRROR_USER }}@hub.athenaos.org:/srv/mirrors/athena/