From 6294cd684ff16b39244d771385a6dfaf951a9a1e Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 23 Sep 2021 09:15:18 +0200 Subject: [PATCH] ci: Correct font version information for new Cascadia releases [why] When the CI is triggered (via cron) for a new Cascadia release we tag our repository only after successful Delugia generation. But we use the tag to determine which version is to be written into the font files, that we create. This means the version information in the font files is correct for manually run release jobs, but not on an cron-automated one. [how] First impulse was to just move the tagging up to happen before we create the new fonts - in fact before we fetch our repo? But maybe we want to tag our repo only if we could successfully release something. To achieve this we use the repo's tag only if there was already a release with the latest Cascadia version. If the latest Cascadia version has never been release by us (as Delugia) we directly use the new version number as our version. If we succeed in creating the fonts our repo will get the tag anyhow. Fixes: #66 Signed-off-by: Fini Jastrow --- .github/workflows/ci.yaml | 13 +++++++++++++ do_generate | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67ab72b..3d7177f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,11 +49,24 @@ jobs: runs-on: ubuntu-18.04 env: NERDFONTVERS: v2.1.0 + CASCADIATAG: ${{ needs.check-for-new-cascadia.outputs.tag_name }} + CASCADIATAG_ISNOTNEW: ${{ needs.check-for-new-cascadia.outputs.tag_exists }} steps: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Decide on version + run: | + if [ "${CASCADIATAG_ISNOTNEW}" = "false" ]; then + echo New release is not tagged yet in our repo + echo It will only be tagged after successfull release in job 'Create tag' + OURVERSION=${CASCADIATAG} + else + echo Re-release uses our manual tags and/or patchlevel + OURVERSION=`git describe --always --tags` + fi + echo "OURVERSION=${OURVERSION}" >> $GITHUB_ENV - name: Download latest version of Cascadia run: | CASCADIAVERS=`curl -L 'https://github.com/microsoft/cascadia-code/releases/latest' | grep CascadiaCode | sed 's!\(.*/microsoft/cascadia-code/releases/download/\([^"]*\).*\|.*span.*\)!\2!'` diff --git a/do_generate b/do_generate index ab9989a..44e1091 100755 --- a/do_generate +++ b/do_generate @@ -23,5 +23,8 @@ fi rm -f C*.ttf fontforge -script font-patcher --careful "${3}" --custom SomeExtraSymbols.otf --no-progressbars "ttf/static/${4}" "${2}" | tee "process${1}.log" -OURVERSION=`git describe --always --tags` +if [ -z "${OURVERSION}" ]; then + # Github CI sets this variable, but this can be useful for manual calls: + OURVERSION=`git describe --always --tags` +fi fontforge rename-font --input C*.ttf --output "${5}" --name "${6}" --style "${7}" --version "${OURVERSION}"