action.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: 'Setup Build Environment'
  2. description: 'Clones dependencies and exports mkbootimg/avbtool paths'
  3. runs:
  4. using: composite
  5. steps:
  6. - shell: bash
  7. run: |
  8. set -euo pipefail
  9. mkdir -p "${{ github.workspace }}/kernel"
  10. mkdir -p "${{ github.workspace }}/git-repo"
  11. curl -L https://storage.googleapis.com/git-repo-downloads/repo -o "${{ github.workspace }}/git-repo/repo"
  12. chmod +x "${{ github.workspace }}/git-repo/repo"
  13. echo "${{ github.workspace }}/git-repo" >> "$GITHUB_PATH"
  14. if [ -d "${{ github.workspace }}/kernel_patches" ]; then rm -rf "${{ github.workspace }}/kernel_patches"; fi
  15. git clone https://github.com/WildKernels/kernel_patches.git "${{ github.workspace }}/kernel_patches"
  16. if [ -d "${{ github.workspace }}/AnyKernel3" ]; then rm -rf "${{ github.workspace }}/AnyKernel3"; fi
  17. git clone https://github.com/WildKernels/AnyKernel3.git -b gki-2.0 "${{ github.workspace }}/AnyKernel3"
  18. AOSP_MIRROR=https://android.googlesource.com
  19. BRANCH=main-kernel-2025
  20. git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
  21. git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
  22. echo "AVBTOOL=${{ github.workspace }}/kernel-build-tools/linux-x86/bin/avbtool" >> "$GITHUB_ENV"
  23. echo "MKBOOTIMG=${{ github.workspace }}/mkbootimg/mkbootimg.py" >> "$GITHUB_ENV"
  24. echo "UNPACK_BOOTIMG=${{ github.workspace }}/mkbootimg/unpack_bootimg.py" >> "$GITHUB_ENV"
  25. echo "BOOT_SIGN_KEY_PATH=${{ github.workspace }}/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> "$GITHUB_ENV"
  26. mkdir -p "${{ github.workspace }}/kernel-build-tools/linux-x86/share/avb"
  27. if [ -z "${BOOT_SIGN_KEY:-}" ]; then
  28. exit 1
  29. fi
  30. KEY_PATH="${{ github.workspace }}/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem"
  31. printf '%s' "$BOOT_SIGN_KEY" > "$KEY_PATH"
  32. if ! head -n 1 "$KEY_PATH" | grep -q 'BEGIN'; then
  33. printf '%s' "$BOOT_SIGN_KEY" | base64 -d > "$KEY_PATH"
  34. fi
  35. chmod 600 "$KEY_PATH"