Repository navigation
fix sha256sums count mismatch in mochiboot PKGBUILD #35
This file contains hidden or 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: Public Repo | |
| on: | |
| push: | |
| paths: | |
| - "pkgbuilds/mochi/**" | |
| - "mochi/**" | |
| - "pkgbuilds/mochiinstall/**" | |
| - "pkgbuilds/mochiboot/**" | |
| - "mochiinstall_wrapper" | |
| - "installer.py" | |
| - "mochiinstall_app.py" | |
| - "mochi_ascii.py" | |
| - "scripts/**" | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: archlinux:latest | |
| options: --privileged | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup | |
| run: | | |
| pacman-key --init | |
| pacman-key --populate archlinux | |
| pacman -Sy --noconfirm base-devel go python python-textual zstd git fakeroot nasm autoconf automake mtools | |
| - name: Create builder | |
| run: | | |
| useradd -m builder | |
| echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
| - name: GPG key | |
| run: | | |
| mkdir -p /home/builder/.gnupg | |
| chmod 700 /home/builder/.gnupg | |
| printf 'Key-Type: RSA\nKey-Length: 4096\nSubkey-Type: RSA\nSubkey-Length: 4096\nName-Real: MochiOS\nName-Email: repo@mochios.dev\nExpire-Date: 0\n%%no-protection\n%%commit\n' | gpg --homedir /home/builder/.gnupg --batch --gen-key | |
| mkdir -p /repo/pubkey | |
| gpg --homedir /home/builder/.gnupg --export --armor repo@mochios.dev > /repo/pubkey/mochios-key.pub | |
| - name: Build mochi | |
| run: | | |
| chown -R builder:builder "$PWD" | |
| cd pkgbuilds/mochi | |
| pkgver=$(grep -oP '^pkgver=\K.*' PKGBUILD | head -1) | |
| tar czf "mochi-$pkgver.tar.gz" -C "$PWD/../../mochi" . | |
| export GOTOOLCHAIN=local | |
| sudo -u builder makepkg -cf --noconfirm --nodeps | |
| - name: Build mochiinstall | |
| run: | | |
| cd pkgbuilds/mochiinstall | |
| pkgver=$(grep -oP '^pkgver=\K.*' PKGBUILD | head -1) | |
| tar czf "mochiinstall-$pkgver.tar.gz" \ | |
| -C "$PWD/../.." \ | |
| mochiinstall_wrapper installer.py mochiinstall_app.py mochiinstall_gui.py mochi_ascii.py | |
| sudo -u builder makepkg -cf --noconfirm --nodeps | |
| - name: Build mochiboot | |
| run: | | |
| cd pkgbuilds/mochiboot | |
| pkgver=$(grep -oP '^pkgver=\K.*' PKGBUILD | head -1) | |
| tar czf "mochiboot-$pkgver.tar.gz" --exclude="mochiboot-$pkgver.tar.gz" --exclude='pkg' --exclude='src' * | |
| sudo -u builder makepkg -cf --noconfirm --nodeps | |
| - name: Create repo | |
| run: | | |
| mkdir -p /repo/os/x86_64 | |
| for f in pkgbuilds/mochi/mochi-*.pkg.tar.zst pkgbuilds/mochiinstall/mochiinstall-*.pkg.tar.zst pkgbuilds/mochiboot/mochiboot-*.pkg.tar.zst; do | |
| [ -f "$f" ] || continue | |
| cp "$f" /repo/os/x86_64/ | |
| done | |
| cp /repo/pubkey/mochios-key.pub /repo/os/x86_64/ | |
| - name: Sign packages + repo-add | |
| run: | | |
| cd /repo/os/x86_64 | |
| for pkg in *.pkg.tar.zst; do | |
| gpg --homedir /home/builder/.gnupg \ | |
| --batch --no-tty --pinentry-mode=loopback --passphrase "" \ | |
| --detach-sign "$pkg" 2>/dev/null || true | |
| done | |
| repo-add --sign mochi.db.tar.zst *.pkg.tar.zst | |
| - name: Static binary | |
| run: | | |
| mkdir -p /repo/static /tmp/mochi-extract | |
| cd /repo/os/x86_64 | |
| pkgfile="$(ls mochi-*.pkg.tar.zst | grep -v debug | head -1)" | |
| tar -I zstd -xf "$pkgfile" -C /tmp/mochi-extract | |
| cp /tmp/mochi-extract/usr/bin/mochi /repo/static/mochi | |
| chmod +x /repo/static/mochi | |
| - name: Install script | |
| run: | | |
| cp "$PWD/scripts/install.sh" /repo/install.sh | |
| chmod +x /repo/install.sh | |
| - name: Deploy to gh-pages | |
| run: | | |
| cd /repo | |
| git init | |
| git config user.name "bot" | |
| git config user.email "bot@mochios.dev" | |
| git checkout -b gh-pages | |
| git add -A | |
| git commit -m "repo: update packages [ci skip]" | |
| git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| git push -f origin gh-pages |