|
| 1 | +name: Build Raspberry Pi OS Lite (arm64) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v*'] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build arm64 Lite image (stage0-2) |
| 14 | + runs-on: ubuntu-24.04-arm |
| 15 | + timeout-minutes: 120 |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + sudo apt-get update |
| 24 | + sudo apt-get install -y coreutils quilt parted debootstrap zerofree zip \ |
| 25 | + dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc \ |
| 26 | + gpg pigz xxd arch-test qemu-user-static |
| 27 | +
|
| 28 | + - name: Configure build |
| 29 | + run: | |
| 30 | + cat > config <<'EOF' |
| 31 | + IMG_NAME=cardputerzero-trixie-arm64 |
| 32 | + RELEASE=trixie |
| 33 | + TARGET_HOSTNAME=cardputerzero |
| 34 | + FIRST_USER_NAME=pi |
| 35 | + FIRST_USER_PASS=raspberry |
| 36 | + ENABLE_SSH=1 |
| 37 | + LOCALE_DEFAULT=en_US.UTF-8 |
| 38 | + KEYBOARD_KEYMAP=us |
| 39 | + KEYBOARD_LAYOUT="English (US)" |
| 40 | + TIMEZONE_DEFAULT=Asia/Shanghai |
| 41 | + EOF |
| 42 | + sed -i 's/^ //' config |
| 43 | +
|
| 44 | + # Build only stage0-2 (Lite image) |
| 45 | + touch stage3/SKIP stage4/SKIP stage5/SKIP |
| 46 | + touch stage3/SKIP_IMAGES stage4/SKIP_IMAGES stage5/SKIP_IMAGES |
| 47 | +
|
| 48 | + - name: Build image |
| 49 | + run: sudo ./build.sh |
| 50 | + |
| 51 | + - name: Find and compress image |
| 52 | + id: image |
| 53 | + run: | |
| 54 | + IMG=$(find deploy/ -name "*.img" -type f | head -1) |
| 55 | + echo "Found: $IMG" |
| 56 | + ls -lh "$IMG" |
| 57 | + xz -9 -T0 "$IMG" |
| 58 | + XZ="${IMG}.xz" |
| 59 | + ls -lh "$XZ" |
| 60 | + echo "path=$XZ" >> "$GITHUB_OUTPUT" |
| 61 | + echo "name=$(basename $XZ)" >> "$GITHUB_OUTPUT" |
| 62 | +
|
| 63 | + - name: Upload artifact |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: cardputerzero-lite-image |
| 67 | + path: ${{ steps.image.outputs.path }} |
| 68 | + |
| 69 | + - name: Create prerelease |
| 70 | + if: startsWith(github.ref, 'refs/tags/') |
| 71 | + uses: softprops/action-gh-release@v2 |
| 72 | + with: |
| 73 | + prerelease: true |
| 74 | + generate_release_notes: true |
| 75 | + files: ${{ steps.image.outputs.path }} |
0 commit comments