action.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: 'Apply Kernel Branding & Timestamp'
  2. description: 'Apply Wild kernel branding to kernel version string'
  3. inputs:
  4. variant:
  5. description: 'Variant of kernel to apply branding to'
  6. required: true
  7. kernel_version:
  8. description: 'Kernel version (e.g., 6.1)'
  9. required: true
  10. android_version:
  11. description: 'Android version (e.g., android14)'
  12. required: true
  13. version:
  14. description: 'Combined version (e.g., android14-6.1)'
  15. required: true
  16. sublevel:
  17. description: 'Sublevel of kernel version (e.g., 1)'
  18. required: true
  19. runs:
  20. using: "composite"
  21. steps:
  22. - name: Apply Kernel Name Branding
  23. shell: bash
  24. working-directory: ${{ github.workspace }}/kernel/common
  25. run: |
  26. CONFIG_FRAGMENT="${{ github.workspace }}/wild_gki.fragment"
  27. touch "$CONFIG_FRAGMENT"
  28. DEFCONFIG="${{ github.workspace }}/kernel/common/arch/arm64/configs/gki_defconfig"
  29. VERSION="${{ inputs.version }}"
  30. ANDROID_PART=$(echo "$VERSION" | cut -d- -f1)
  31. KERNEL_PART=$(echo "$VERSION" | cut -d- -f2)
  32. if [ "${{ inputs.variant }}" == "Wild" ]; then
  33. tac scripts/setlocalversion | awk '!seen && /^echo / {seen=1; next} 1' | tac > scripts/setlocalversion.tmp
  34. mv scripts/setlocalversion.tmp scripts/setlocalversion
  35. if [[ "$KERNEL_PART" == "6.6" || "$KERNEL_PART" == "6.12" ]]; then
  36. KERNEL_STRING="$KERNEL_PART.${{ inputs.sublevel }}-$ANDROID_PART"
  37. echo "echo \"$KERNEL_STRING-Wild\"" >> scripts/setlocalversion
  38. else
  39. echo 'echo "-Wild"' >> scripts/setlocalversion
  40. fi
  41. chmod +x scripts/setlocalversion
  42. else
  43. if grep -q '^CONFIG_LOCALVERSION=' "$DEFCONFIG"; then
  44. LOCALVERSION_VALUE="$(grep -m1 '^CONFIG_LOCALVERSION=' "$DEFCONFIG" | sed -E 's/^CONFIG_LOCALVERSION="?([^"]*)"?$/\1/')"
  45. echo "CONFIG_LOCALVERSION=\"${LOCALVERSION_VALUE}-Wild\"" >> "$CONFIG_FRAGMENT"
  46. else
  47. echo 'CONFIG_LOCALVERSION="-Wild"' >> "$CONFIG_FRAGMENT"
  48. fi
  49. fi
  50. : > .scmversion
  51. - name: Apply Kernel Configuration
  52. if: ${{ inputs.variant == 'Wild' }}
  53. shell: bash
  54. run: |
  55. cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF'
  56. CONFIG_LOCALVERSION=""
  57. # CONFIG_LOCALVERSION_AUTO is not set
  58. EOF