name: 'Apply Kernel Branding & Timestamp' description: 'Apply Wild kernel branding to kernel version string' inputs: variant: description: 'Variant of kernel to apply branding to' required: true kernel_version: description: 'Kernel version (e.g., 6.1)' required: true android_version: description: 'Android version (e.g., android14)' required: true sublevel: description: 'Sublevel of kernel version (e.g., 1)' required: true runs: using: "composite" steps: - name: Apply Kernel Name Branding shell: bash working-directory: ${{ github.workspace }}/kernel/common run: | CONFIG_FRAGMENT="${GITHUB_WORKSPACE}/wild_gki.fragment" touch "$CONFIG_FRAGMENT" DEFCONFIG="${GITHUB_WORKSPACE}/kernel/common/arch/arm64/configs/gki_defconfig" if [ "${{ inputs.variant }}" = "Wild" ]; then tac scripts/setlocalversion | awk '!seen && /^echo / {seen=1; next} 1' | tac > scripts/setlocalversion.tmp mv scripts/setlocalversion.tmp scripts/setlocalversion if [ ${{ inputs.kernel_version }} == "6.6" || ${{ inputs.kernel_version }} == "6.12" ]; then KERNEL_STRING="${{ inputs.kernel_version }}.${{ inputs.sublevel }}" echo "echo \"$KERNEL_STRING-Wild\"" >> scripts/setlocalversion else echo 'echo "-Wild"' >> scripts/setlocalversion fi else if grep -q '^CONFIG_LOCALVERSION=' "$DEFCONFIG"; then LOCALVERSION_VALUE="$(grep -m1 '^CONFIG_LOCALVERSION=' "$DEFCONFIG" | sed -E 's/^CONFIG_LOCALVERSION="?([^"]*)"?$/\1/')" echo "CONFIG_LOCALVERSION=\"${LOCALVERSION_VALUE}-Wild\"" >> "$CONFIG_FRAGMENT" else echo 'CONFIG_LOCALVERSION="-Wild"' >> "$CONFIG_FRAGMENT" fi fi : > .scmversion echo "Getting last commit timestamp from kernel source..." COMMIT_TIMESTAMP=$(git log -1 --format=%ct 2>/dev/null || echo "$(date +%s)") KERNEL_BUILD_DATE=$(date -u) export SOURCE_DATE_EPOCH=$COMMIT_TIMESTAMP echo "SOURCE_DATE_EPOCH=$COMMIT_TIMESTAMP" >> $GITHUB_ENV export KBUILD_BUILD_TIMESTAMP="$KERNEL_BUILD_DATE" echo "KBUILD_BUILD_TIMESTAMP=$KERNEL_BUILD_DATE" >> $GITHUB_ENV - name: Apply Kernel Configuration if: ${{ inputs.variant == 'Wild' }} shell: bash run: | cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF' CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set EOF