.github: Simplify kernel patch script

No point in setting UPDATE_NEEDED to zero if we exit the script
without doing anything with the just set variable.

Also to avoid mismatches in branch names, export the branch name as a
github workflow step output, so the follow-up steps can pick it up and
use.
This commit is contained in:
Krzesimir Nowak 2022-10-13 13:15:23 +02:00
parent b15055684e
commit 053fe006d3
2 changed files with 6 additions and 7 deletions

View File

@ -4,14 +4,13 @@ set -euo pipefail
# trim the 3rd part in the input semver, e.g. from 5.4.1 to 5.4
VERSION_SHORT=${VERSION_NEW%.*}
UPDATE_NEEDED=1
BRANCH_NAME="linux-${VERSION_NEW}-${TARGET}"
. .github/workflows/common.sh
prepare_git_repo
if ! checkout_branches "linux-${VERSION_NEW}-${TARGET}"; then
UPDATE_NEEDED=0
if ! checkout_branches "${BRANCH_NAME}"; then
exit 0
fi
@ -23,7 +22,6 @@ if [[ -z "${VERSION_OLD}" ]]; then
fi
if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then
echo "already the latest Kernel, nothing to do"
UPDATE_NEEDED=0
exit 0
fi
@ -77,5 +75,6 @@ generate_patches sys-kernel coreos-sources Kernel
apply_patches
echo ::set-output name=VERSION_OLD::"${VERSION_OLD}"
echo ::set-output name=UPDATE_NEEDED::"${UPDATE_NEEDED}"
echo "VERSION_OLD=${VERSION_OLD}" >>"${GITHUB_OUTPUT}"
echo "UPDATE_NEEDED=1" >>"${GITHUB_OUTPUT}"
echo "BRANCH_NAME=${BRANCH_NAME}" >>"${GITHUB_OUTPUT}"

View File

@ -53,7 +53,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ steps.figure-out-branch.outputs.BRANCH }}
branch: linux-${{ steps.fetch-latest-release.outputs.KERNEL_VERSION }}-${{ steps.figure-out-branch.outputs.BRANCH }}
branch: ${{ steps.apply-patch.outputs.BRANCH_NAME }}
author: Flatcar Buildbot <buildbot@flatcar-linux.org>
committer: Flatcar Buildbot <buildbot@flatcar-linux.org>
title: Upgrade Linux Kernel for ${{ steps.figure-out-branch.outputs.BRANCH }} from ${{ steps.apply-patch.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.KERNEL_VERSION }}