.github: Simplify ca-certificates patch script

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

Also fix the mismatch in branch names - we normally create a branch
like "cacerts-${NSS_VERSION}-${BRANCH}" in the last workflow step
whereas we were checking if a branch like "${NSS_VERSION}-${BRANCH}"
existed in the script. To avoid repetition, 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-11 17:25:52 +02:00
parent c1a9aa5a97
commit 8d00adc16c
2 changed files with 7 additions and 8 deletions

View File

@ -2,14 +2,13 @@
set -euo pipefail
UPDATE_NEEDED=1
. .github/workflows/common.sh
BRANCH_NAME="cacerts-${VERSION_NEW}-${TARGET}"
prepare_git_repo
if ! checkout_branches "${VERSION_NEW}-${TARGET}"; then
UPDATE_NEEDED=0
if ! checkout_branches "${BRANCH_NAME}"; then
exit 0
fi
@ -19,7 +18,6 @@ pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit
VERSION_OLD=$(sed -n "s/^DIST nss-\([0-9]*\.[0-9]*\).*$/\1/p" app-misc/ca-certificates/Manifest | sort -ruV | head -n1)
if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then
echo "already the latest ca-certificates, nothing to do"
UPDATE_NEEDED=0
exit 0
fi
@ -37,5 +35,6 @@ generate_patches app-misc ca-certificates ca-certificates
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

@ -47,7 +47,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: ${{ steps.figure-out-branch.outputs.BRANCH }}
branch: cacerts-${{ steps.fetch-latest-release.outputs.NSS_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 ca-certificates in ${{ steps.figure-out-branch.outputs.BRANCH }} from ${{ steps.apply-patch.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.NSS_VERSION }}