action.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. name: 'Extract Sublevel and File Name'
  2. description: 'Reads Makefile sublevel and composes FILE_NAME'
  3. inputs:
  4. kernel_version:
  5. required: true
  6. type: string
  7. android_version:
  8. required: true
  9. type: string
  10. os_patch_level:
  11. required: true
  12. type: string
  13. variant:
  14. required: true
  15. type: string
  16. sublevel:
  17. required: true
  18. type: string
  19. outputs:
  20. file_name:
  21. value: ${{ steps.extract.outputs.file_name }}
  22. sublevel:
  23. value: ${{ steps.extract.outputs.sublevel }}
  24. runs:
  25. using: composite
  26. steps:
  27. - id: extract
  28. shell: bash
  29. run: |
  30. set -euo pipefail
  31. SUBLEVEL="${{ inputs.sublevel }}"
  32. if [ -f "${{ github.workspace }}/kernel/common/Makefile" ]; then
  33. EXTRACTED="$(grep '^SUBLEVEL = ' "${{ github.workspace }}/kernel/common/Makefile" | awk '{print $3}')"
  34. if [ "${{ inputs.os_patch_level }}" = "lts" ] && [ -n "$EXTRACTED" ]; then
  35. SUBLEVEL="$EXTRACTED"
  36. fi
  37. fi
  38. FILE_NAME="${{ inputs.kernel_version }}.${SUBLEVEL}-${{ inputs.android_version }}-${{ inputs.os_patch_level }}"
  39. # Append variant only when it's provided and not the default 'Normal'
  40. if [ -n "${{ inputs.variant }}" ] && [ "${{ inputs.variant }}" != "Normal" ]; then
  41. FILE_NAME="${FILE_NAME}-${{ inputs.variant }}"
  42. fi
  43. echo "SUBLEVEL=$SUBLEVEL" >> "$GITHUB_ENV"
  44. echo "FILE_NAME=$FILE_NAME" >> "$GITHUB_ENV"
  45. echo "file_name=$FILE_NAME" >> "$GITHUB_OUTPUT"
  46. echo "sublevel=$SUBLEVEL" >> "$GITHUB_OUTPUT"