Repository navigation
fix: autostart trust, pacstrap streaming, cleanup failsafe #45
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" | |
| - "build.sh" | |
| - "scripts/**" | |
| - ".github/workflows/repo.yml" | |
| - ".github/workflows/build-iso.yml" | |
| 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 clang lld llvm | |
| - 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' * | |
| CC_FOR_TARGET=gcc LD_FOR_TARGET=ld.lld OBJCOPY_FOR_TARGET=llvm-objcopy 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: Replace symlinks with real files | |
| run: | | |
| echo "checking /repo/os/x86_64..." | |
| ls -la /repo/os/x86_64/ || echo "dir not found!" | |
| cd /repo/os/x86_64 | |
| for f in mochi.db mochi.files; do | |
| if [ -L "$f" ]; then | |
| real="${f}.tar.zst" | |
| rm -f "$f" "${f}.sig" | |
| cp -v "$real" "$f" || echo "cp failed for $real" | |
| fi | |
| if [ -f "${f}.tar.zst.sig" ]; then | |
| cp -v "${f}.tar.zst.sig" "${f}.sig" || true | |
| fi | |
| done | |
| echo "done" | |
| - 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 |