From f2ed019e6350db3d647c4067ead4e850f28eaaf9 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 23 Aug 2022 15:24:32 +0200 Subject: [PATCH 01/22] CI: Remove outdated steps [why] Fonttools, FreeType, and HarfBuzz are not used in the CI job. Propably a leftover from thomething done in the past? [how] Because I can not find out the reason WHY they are there the lines are kept and just disabled. This leaves a nice 'stub' for git blame in the file. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65dbea66e..c9a7e8ed1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -92,11 +92,15 @@ jobs: echo Try appimage with path fontforge --version + # It is unclear what this has been needed for - name: Setup additional dependencies + if: false run: | pip install fonttools --quiet + # It is unclear what this has been needed for - name: Build FreeType from source + if: false run: | wget http://downloads.sourceforge.net/project/freetype/freetype2/2.7/freetype-2.7.tar.gz --quiet tar -zxf freetype-2.7.tar.gz @@ -105,7 +109,9 @@ jobs: make --quiet sudo make install --quiet + # It is unclear what this has been needed for - name: Build Harfbuzz from source + if: false run: | wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2 --quiet tar -xjf harfbuzz-1.3.4.tar.bz2 From d2b94f557b208127fbeddd5aeb961f82bdb9e492 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 23 Aug 2022 15:59:54 +0200 Subject: [PATCH 02/22] CI: Use GH action to upload release files [why] The self-written upload-archives script is some issues, for example it does not replace preexisting release files with new ones when a release is re-triggered. The error messages are rudimentary at best. [how] Use https://github.com/softprops/action-gh-release instead. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 20 +++++--- bin/scripts/release.sh | 4 +- bin/scripts/upload-archives.sh | 88 ---------------------------------- 3 files changed, 17 insertions(+), 95 deletions(-) delete mode 100755 bin/scripts/upload-archives.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9a7e8ed1..18b02a206 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -149,11 +149,17 @@ jobs: ./generate-fontconfig.sh ./generate-casks.sh "${{ matrix.font }}" - - name: Archive font package zip files and upload for release + - name: Archive font package zip files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" ./archive-fonts.sh "${{ matrix.font }}" - GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "${{ matrix.font }}" + + - name: Upload zip file archive for release + uses: softprops/action-gh-release@v0.1.14 + with: + prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} + tag_name: ${{ env.RELEASE_TAG_VERSION }} + files: archives/* - name: Upload patched fonts as artifacts uses: actions/upload-artifact@v2 @@ -193,10 +199,12 @@ jobs: cd -- "$GITHUB_WORKSPACE/bin/scripts" ./archive-font-patcher.sh - - name: Archive font package zip files and upload for release - run: | - cd -- "$GITHUB_WORKSPACE/bin/scripts" - GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "FontPatcher" + - name: Upload font-patcher archive for release + uses: softprops/action-gh-release@v0.1.14 + with: + prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} + tag_name: ${{ env.RELEASE_TAG_VERSION }} + files: archives/* commit: name: Commit and push patched fonts to the repo diff --git a/bin/scripts/release.sh b/bin/scripts/release.sh index b03f21d39..fd248c3aa 100755 --- a/bin/scripts/release.sh +++ b/bin/scripts/release.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash # Nerd Fonts Version: 2.1.0 # calls the necessary scripts in the necessary order to prepare for a release +# +# This is not used for production #set -x LINE_PREFIX="# [Nerd Fonts] " @@ -18,7 +20,7 @@ release=$1 ./generate-fontconfig.sh ./generate-casks.sh ./archive-fonts.sh -#./upload-archives.sh # better done as a separate step +#./upload-archives.sh # better done as a separate step (via gh action) exit diff --git a/bin/scripts/upload-archives.sh b/bin/scripts/upload-archives.sh deleted file mode 100755 index ec63421f9..000000000 --- a/bin/scripts/upload-archives.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# Nerd Fonts Version: 2.1.0 -# Script Version: 1.2.0 -# Iterates over all archives and uploads to given release - -# uncomment to debug: -#set -x - -LINE_PREFIX="# [Nerd Fonts] " - -cd ../../archives/ || { - echo >&2 "$LINE_PREFIX Could not find archives directory" - exit 1 -} - -# We don't need to use a separate access token for accessing Github API when we -# are in a Github action, can use the auto provided `GITHUB_TOKEN` -# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication -TOKEN=$GITHUB_TOKEN -OWNER="ryanoasis" -REPO="nerd-fonts" -RELEASE_TAG="" - -if [ -z "$1" ] - then - # before we used to check for tag param and set release URL to releases/latest - # but to simplify things let's just fail and always require a proper release/tag - echo "$LINE_PREFIX No Tag Release was given" - exit 1 -else - echo "$LINE_PREFIX Tag/Release was $1" - RELEASE_TAG="$1" -fi - -if [ -z "$2" ] - then - search_pattern="*.zip" - echo "$LINE_PREFIX No limiting pattern given, will search entire folder" -else - pattern=$2 - search_pattern="*$2*.zip" - echo "$LINE_PREFIX Limiting upload archive to pattern '$pattern'" -fi - -CURL_DATA="\"tag_name\":\"${RELEASE_TAG}\"" - -if [ "$PRERELEASE" == "true" ] - then - CURL_DATA+=", \"prerelease\": true" -fi - -RELEASE_URL="https://api.github.com/repos/${OWNER}/${REPO}/releases/tags/${RELEASE_TAG}" - -#if [ "$LAST_RELEASE_ID" = null] -# then -# @TODO add error checking around creating new release if release/tag already exists -echo "$LINE_PREFIX Creating new release/tag of ${RELEASE_TAG}" -curl \ - -H "Authorization:token $TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/$OWNER/$REPO/releases \ - -d "{$CURL_DATA}" -#else -# echo "$LINE_PREFIX A release did exist and the most recent release id was '$RELEASE'" -#fi - -LAST_RELEASE_ID=$(curl -# -XGET -H "Authorization:token $TOKEN" -H 'Content-Type: application/json' "$RELEASE_URL" | jq -r '.id') - -echo "$LINE_PREFIX The last release id was $LAST_RELEASE_ID" - -#find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font -find ./ -name "$search_pattern" | # uncomment to test all font -while read -r filename -do - - basename=$(basename "$filename") - - printf "$LINE_PREFIX Uploading %s \n" "$basename" - - curl \ - -# -XPOST \ - -H "Authorization:token $TOKEN" \ - -H "Content-Type:application/octet-stream" \ - --data-binary @"$basename" https://uploads.github.com/repos/"$OWNER"/"$REPO"/releases/"$LAST_RELEASE_ID"/assets?name="$basename" - - #exit # uncomment to test only 1 zip - -done From 7b81d7c84ada549285780a60b5be9488508e063c Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 23 Aug 2022 16:05:46 +0200 Subject: [PATCH 03/22] CI: Fix version bump [why] This can not work. Issue 1: It is unspecified in which order the font matrix jobs run, so the version number changes somewhen. The changed (version-bumped) files are never committed and written back, so this would have to be done manually anyhow. The version-bump script itself has issues because the regexes for the change are a bit too loose and other version like strings are changes also (like the Script Version). Issue 2: The script changed versions that should not be changed like the script version in the scripts (rather than the NF release version). In bin/scripts/generate-glyph-info-from-set.py pumping has been forgotten/omitted completely. [how] In the version-bump script: * Use more modern regex * Instead of copying the code use a loop Create a commit with the bumped version information in all scripts. This can only be done with the final job, because we have a problem to checkout the modified version with actions/checkout. We need to bump the version on every patch job, because we need the correct information already in the script when we patch. [note] This does not prevent to have multiple commits attempts that change to the same version. But if the change is empty, no commit will be added and the step is silently ignored. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 27 ++++++++++++++++++++++++--- bin/scripts/version-bump.sh | 19 +++++++++---------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18b02a206..271e37663 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,9 +125,7 @@ jobs: fontforge --version fontforge --version 2>&1 | grep libfontforge | awk '{print $NF}' - - name: Bump version for source files once - # @todo fixme - put in a separate job with the release env setup and output the release info - if: ${{ matrix.font == '3270' }} + - name: Bump version for source files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" ./version-bump.sh "$RELEASE_TAG_VERSION" @@ -194,6 +192,11 @@ jobs: echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV + - name: Bump version for source files + run: | + cd -- "$GITHUB_WORKSPACE/bin/scripts" + ./version-bump.sh "$RELEASE_TAG_VERSION" + - name: Archive font-patcher script for release run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" @@ -224,6 +227,24 @@ jobs: name: patched-fonts path: . + - name: Bump version for source files + run: | + cd -- "$GITHUB_WORKSPACE/bin/scripts" + ./version-bump.sh "$RELEASE_TAG_VERSION" + + - name: Commit version bump changes + # If there are no changes (i.e. we already have that bump commit from a previous run) + # the git commit will fail as empty commit (that we do not explicitely allow here), + # and the action fails silently (i.e. without stopping the job). + # This means there will be only one commit in the repo for each version tag change, + # regardless of how often we run the release CI. + uses: EndBug/add-and-commit@v9 + with: + add: "['font-patcher', 'bin/scripts']" + message: Bump release version + committer_name: GitHub Actions + committer_email: 41898282+github-actions[bot]@users.noreply.github.com + - uses: EndBug/add-and-commit@v9 with: add: 'patched-fonts' diff --git a/bin/scripts/version-bump.sh b/bin/scripts/version-bump.sh index a4a689578..5cbce62ce 100755 --- a/bin/scripts/version-bump.sh +++ b/bin/scripts/version-bump.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Nerd Fonts Version: 2.1.0 -# Script Version: 1.0.1 +# Script Version: 1.0.2 # bump version number for release in scripts (bash and python) # does not do semver format checking # this obviously is not perfect but works good enough for now (YAGNI) @@ -18,13 +18,12 @@ release=$1 echo "$LINE_PREFIX Bump version to $release" -sed -i "s|[0-9]\\.[0-9]\\.[0-9]|$release|g" ../../font-patcher -sed -i "s|\\# Nerd Fonts Version: [0-9]\\.[0-9]\\.[0-9]|\\# Nerd Fonts Version: $release|g" ../../bin/scripts/**/*.sh -sed -i "s|\\# Nerd Fonts Version: [0-9]\\.[0-9]\\.[0-9]|\\# Nerd Fonts Version: $release|g" ../../bin/scripts/**/*.py -sed -i "s|\\# Nerd Fonts Version: [0-9]\\.[0-9]\\.[0-9]|\\# Nerd Fonts Version: $release|g" ../../bin/scripts/*.sh -sed -i "s|\\# Nerd Fonts Version: [0-9]\\.[0-9]\\.[0-9]|\\# Nerd Fonts Version: $release|g" ../../bin/scripts/*.py -sed -i "s|\\# version: [0-9]\\.[0-9]\\.[0-9]|\\# version: $release|g" ../../bin/scripts/*.sh -sed -i "s|version=\"[0-9]\\.[0-9]\\.[0-9]\"|version=\"$release\"|g" ../../bin/scripts/*.sh - -exit +function patch_file { + echo patching $1 + sed -i -E "s/^(# Nerd Fonts Version: )[0-9]+\.[0-9]+\.[0-9]+.*/\1$release/" "$1" + sed -i -E "s/^(version *= *\")[0-9]+\.[0-9]+\.[0-9]+.*(\") *$/\1$release\2/" "$1" +} +while IFS= read -r file; do + patch_file "$file" +done < <(find ../.. -name "*.sh" -o -name "*.py" -o -name "font-patcher" -type f) From aa48eea360419f08fc916728a4194bd32668a0ea Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 23 Aug 2022 17:36:16 +0200 Subject: [PATCH 04/22] font-patcher: Show script version on run [why] We show only the Release version of the patcher script. Often it is unclear which particular script people are using. [how] Also show the script version. This is a bit frickle, as it needs developers to change the number manually (as with all other scripts in the project that have a script version), but so be it. This could be replaced by the 'current' git hash. But that has the drawback that one needs to search for the commit to see how old the script is. Signed-off-by: Fini Jastrow --- font-patcher | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/font-patcher b/font-patcher index 30acc176a..f1b4b5733 100755 --- a/font-patcher +++ b/font-patcher @@ -1,10 +1,13 @@ #!/usr/bin/env python # coding=utf8 # Nerd Fonts Version: 2.1.0 -# script version: 3.0.1 +# Script version is further down from __future__ import absolute_import, print_function, unicode_literals +# Change the script version when you edit this script: +script_version = "3.0.2" + version = "2.1.0" projectName = "Nerd Fonts" projectNameAbbreviation = "NF" @@ -196,7 +199,7 @@ class font_patcher: def patch(self): - print("{} Patcher v{} executing\n".format(projectName, version)) + print("{} Patcher v{} ({}) executing\n".format(projectName, version, script_version)) if self.args.single: # Force width to be equal on all glyphs to ensure the font is considered monospaced on Windows. From a57403f83308a0db027155ee3dada9aaed4ba554 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 08:10:46 +0200 Subject: [PATCH 05/22] CI: Centralize release version determination [why] We need the release tag version in all jobs. [how] Instead of determining it in every job again and again (with the same code) we set an output in the first job and reuse it everywhere. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 57 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 271e37663..0e14ec5d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,8 +37,29 @@ jobs: echo "::set-output name=matrix::${fontNames}" echo ${{ steps.set-matrix.outputs.matrix }} + - name: Fetch release version + id: rel_ver + run: | + cd -- "$GITHUB_WORKSPACE" + echo "Contents of package.json:" + cat package.json + RELEASE_TAG_VERSION=$(cat package.json \ + | grep version \ + | head -1 \ + | awk -F: '{ print $2 }' \ + | sed 's/[",]//g') + echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV + echo "::set-output name=val::$RELEASE_TAG_VERSION" + + - name: Determine candidate status + id: rel_can + run: | + [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false" + outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} + rel_version: ${{ steps.rel_ver.outputs.val }} + rel_candidate: ${{ steps.rel_can.outputs.val }} # Workflow to build and install dependencies build: @@ -50,6 +71,8 @@ jobs: env: GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} strategy: matrix: @@ -58,17 +81,10 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - name: Set release variables + - name: Check release variables run: | - cd -- "$GITHUB_WORKSPACE" - cat package.json - RELEASE_TAG_VERSION=$(cat package.json \ - | grep version \ - | head -1 \ - | awk -F: '{ print $2 }' \ - | sed 's/[",]//g') - echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV - [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV + echo "$RELEASE_TAG_VERSION" + echo "Candidate: $RELEASE_CANDIDATE" # Install and setup Dependencies # @TODO cache the next 4 steps with actions/cache or upload @@ -171,27 +187,17 @@ jobs: release-font-patcher: name: Archive font patcher and add to release - needs: build + needs: [ setup-fonts-matrix, build ] env: GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set release variables - run: | - cd -- "$GITHUB_WORKSPACE" - cat package.json - RELEASE_TAG_VERSION=$(cat package.json \ - | grep version \ - | head -1 \ - | awk -F: '{ print $2 }' \ - | sed 's/[",]//g') - echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV - [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV - - name: Bump version for source files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" @@ -211,7 +217,7 @@ jobs: commit: name: Commit and push patched fonts to the repo - needs: build + needs: [ setup-fonts-matrix, build ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -228,6 +234,9 @@ jobs: path: . - name: Bump version for source files + env: + RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" ./version-bump.sh "$RELEASE_TAG_VERSION" From abdae7bb01f7a0c1c401bb3f296e8f4f9f39afe0 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 08:46:06 +0200 Subject: [PATCH 06/22] CI: Strip blanks from release tag version string Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e14ec5d3..c50790482 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: | grep version \ | head -1 \ | awk -F: '{ print $2 }' \ - | sed 's/[",]//g') + | sed 's/[ ",]//g') echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV echo "::set-output name=val::$RELEASE_TAG_VERSION" From f5a9a007da072f34dd02bbc8feee9bd1c67c8c7d Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 08:43:33 +0200 Subject: [PATCH 07/22] CI: Simplify checkout for matrix setup [why] We check the whole repo out, just to set up the font matrix. All data is thrown away afterwards. That takes needless time. [how] Just check out the two files we really need for the setup (the script and the database). Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c50790482..29a8aaed4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,11 +27,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + # Faster version instead of - uses: actions/checkout@v3 + - uses: Bhacaz/checkout-files@v2 + with: + files: package.json bin/scripts/get-font-names-from-json.sh bin/scripts/lib/fonts.json + branch: ${{ github.head_ref || github.ref_name }} - id: set-matrix run: | cd -- $GITHUB_WORKSPACE/bin/scripts/ + chmod u+x get-font-names-from-json.sh fontNames=$(./get-font-names-from-json.sh) echo "${fontNames}" echo "::set-output name=matrix::${fontNames}" From 9a33516649962aed4c2a0ebc7a4c35748bfae6ee Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 09:49:32 +0200 Subject: [PATCH 08/22] CI: Add names for some steps Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29a8aaed4..3ed0c879f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: with: files: package.json bin/scripts/get-font-names-from-json.sh bin/scripts/lib/fonts.json branch: ${{ github.head_ref || github.ref_name }} - - + - name: Determine font matrix id: set-matrix run: | cd -- $GITHUB_WORKSPACE/bin/scripts/ @@ -259,7 +259,8 @@ jobs: committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com - - uses: EndBug/add-and-commit@v9 + - name: Commit patched fonts back to repo + uses: EndBug/add-and-commit@v9 with: add: 'patched-fonts' message: Rebuilds patched fonts From fcdb7b04f53106cae949fb8900c01e929f57a33d Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 19:47:11 +0200 Subject: [PATCH 09/22] CI: Advance tag after adding commits to release [why] When people check the repo out at a release tag they expect to get all the files that are IN the release. But we add the patched fonts and the version-bumped scripts only afterwards. [how] Just overwrite (shift) the tag after everything is finished. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ed0c879f..a089dffc2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -266,3 +266,8 @@ jobs: message: Rebuilds patched fonts committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com + + - name: Adjust release tag to include previous commit + uses: EndBug/latest-tag@v1.5.0 + with: + ref: ${{ needs.setup-fonts-matrix.outputs.rel_version }} From bc87b361a2be62844aa9ce7d6127b0a7baf240d9 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 24 Aug 2022 19:49:25 +0200 Subject: [PATCH 10/22] CI: Prevent rolling release on normal releases [why] The release CI is run every time something is pushed to master. This is useful if we are on a release candidate. The release will be updated. But if we do a normal release and afterwards push some new commit to master - before we update the version in the package.json to a RC - the actual (fixed) release will also be updated. [how] Determine if we have a * new normal release * new prerelease * updated prerelease and run the release process itself only in that cases. [note] The release is checked for via API instead of an action, because the typical action needs a complete checkout (works on the local git repo). Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a089dffc2..e2a8c463e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,7 @@ jobs: with: files: package.json bin/scripts/get-font-names-from-json.sh bin/scripts/lib/fonts.json branch: ${{ github.head_ref || github.ref_name }} + - name: Determine font matrix id: set-matrix run: | @@ -61,10 +62,42 @@ jobs: run: | [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false" + - name: Determine new release or re-release + # If the tag exists it is obviously a re-release + + # This would need a complete checkout, that we want to avoid + # uses: mukunku/tag-exists-action@v1.0.0 + # with: + # tag: "${{ env.RELEASE_TAG_VERSION }}" + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: rel_pre_existing + run: | + curl -v "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/tags" | jq '.[].name' | grep '^"${{ steps.rel_ver.outputs.val }}"$' \ + && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" + echo "Tag exists: ${{ steps.rel_pre_existing.outputs.exists }}" + + - name: Upload release only on first trigger for release and always on release candidate + id: upload + # Upload release when: + # * This is a new (previously untagged) release + # * This is a release candidate + run: | + [[ "${{ steps.rel_can.outputs.val }}" == "true" || "${{ steps.rel_pre_existing.outputs.exists }}" == "false" ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false" + + - name: Show outputs + run: | + echo "rel_version: ${{ steps.rel_ver.outputs.val }}" + echo "rel_candidate: ${{ steps.rel_can.outputs.val }}" + echo "rel_pre_existing: ${{ steps.rel_pre_existing.outputs.exists }}" + echo "rel_upload: ${{ steps.upload.outputs.val }}" + outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} rel_version: ${{ steps.rel_ver.outputs.val }} rel_candidate: ${{ steps.rel_can.outputs.val }} + rel_pre_existing: ${{ steps.rel_pre_existing.outputs.exists }} + rel_upload: ${{ steps.upload.outputs.val }} # Workflow to build and install dependencies build: @@ -90,6 +123,7 @@ jobs: run: | echo "$RELEASE_TAG_VERSION" echo "Candidate: $RELEASE_CANDIDATE" + echo "Publish/refresh release: ${{ needs.setup-fonts-matrix.outputs.rel_upload }}" # Install and setup Dependencies # @TODO cache the next 4 steps with actions/cache or upload @@ -175,6 +209,7 @@ jobs: - name: Upload zip file archive for release uses: softprops/action-gh-release@v0.1.14 + if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} tag_name: ${{ env.RELEASE_TAG_VERSION }} @@ -215,6 +250,7 @@ jobs: - name: Upload font-patcher archive for release uses: softprops/action-gh-release@v0.1.14 + if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} tag_name: ${{ env.RELEASE_TAG_VERSION }} @@ -269,5 +305,6 @@ jobs: - name: Adjust release tag to include previous commit uses: EndBug/latest-tag@v1.5.0 + if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: ref: ${{ needs.setup-fonts-matrix.outputs.rel_version }} From e7722458fc7659fc6da68a912451efc21d18f7ba Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 08:04:14 +0200 Subject: [PATCH 11/22] archive-fonts: Fix missing readme in archive [why] When run on more than one font the mini-readme is only added to the first created archive. [how] Remove the readme file only after all archives have been generated. [note] Also rewrite `find` command, to actually do some work. The formulation was rather odd, using a shell glob to find the directories and `find` to select one. Signed-off-by: Fini Jastrow --- bin/scripts/archive-fonts.sh | 10 +++++----- bin/scripts/generate-casks.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/scripts/archive-fonts.sh b/bin/scripts/archive-fonts.sh index f827f6a8e..e9f73e22f 100755 --- a/bin/scripts/archive-fonts.sh +++ b/bin/scripts/archive-fonts.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Nerd Fonts Version: 2.1.0 -# Script Version: 1.1.1 +# Script Version: 1.1.2 # Iterates over all patched fonts directories # to generate ruby cask files for homebrew-fonts (https://github.com/caskroom/homebrew-fonts) # adds Windows versions of the fonts as well (casks files just won't download them) @@ -48,7 +48,7 @@ find "${outputdir:?}" -name "$search_pattern" -type f -delete #find ./ProFont -maxdepth 0 -type d | # uncomment to test 1 font # find ./IBMPlexMono -maxdepth 0 -type d | # uncomment to test 1 font # uncomment to test all fonts: -find -- * -maxdepth 0 -iregex "$pattern" -type d | +find . -maxdepth 1 -iregex "\./$pattern" -type d | while read -r filename do @@ -71,14 +71,14 @@ do # we can copy the font files without full paths but not necessarily the license files: # add license files separately: # zip -9 "$outputdir/$basename" -rj "$searchdir" -i '*license*' -i '*LICENSE*' - # work around to copy duplicate license files (only the last duplicate found) + # work around to copy duplicate license files (only the last duplicate found) # so we don't have to copy entire paths and can still use the junk option (-j) find "$searchdir" -type f -iname "*license*" | awk -F/ '{a[$NF]=$0}END{for(i in a)print a[i]}' | zip -9 -j "$outputdir/$basename" -@ fi; # add mini readme file zip -9 "$outputdir/$basename" -rj "$mini_readme" -q - rm -f "$mini_readme" done +rm -f "$mini_readme" -ls -al "$outputdir" \ No newline at end of file +ls -al "$outputdir" diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index 4bd42bc3b..7ace882b7 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -82,7 +82,7 @@ function write_footer { #find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font #find ./ProFont -maxdepth 2 -type d | # uncomment to test 1 font -find . -maxdepth 1 -mindepth 1 -type d | # uncomment to test 1 font +find . -maxdepth 1 -mindepth 1 -type d -iregex "./$1" | while read -r filename do From e7af933fdf953bdea60d24c640a68ca7ed9487d6 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 08:39:08 +0200 Subject: [PATCH 12/22] generate-casks: Allow to specify pattern [why] The CI uses the script with the font-matrix name, to regenerate the cask of just one font. But the script is ignoring the parmeter and generates all casks. [how] Allow to specify a regex pattern as first parameter and limit the processing to that font(s), as done in archive-fonts.sh Signed-off-by: Fini Jastrow --- bin/scripts/generate-casks.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index 7ace882b7..d6f98e3f1 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -80,9 +80,14 @@ function write_footer { } >> "$outputfile" } +pattern=$1 +if [ "$pattern" = "" ]; then + pattern=".*" +fi + #find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font #find ./ProFont -maxdepth 2 -type d | # uncomment to test 1 font -find . -maxdepth 1 -mindepth 1 -type d -iregex "./$1" | +find . -maxdepth 1 -mindepth 1 -type d -iregex "\./$pattern" | while read -r filename do From e188061e0444acdbe983f626c1d03f6590f0bee4 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 08:41:46 +0200 Subject: [PATCH 13/22] generate-casks: Fix display of currently processed font [why] The script shows # [Nerd Fonts] Generating cask for: . for any font it processes. [how] Well, the variable naming is a bit strange, maybe that is the reason for the bug? We already have the font name in another variable, use that. Signed-off-by: Fini Jastrow --- bin/scripts/generate-casks.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index d6f98e3f1..8b8b2b47a 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -95,7 +95,6 @@ do basename=$(basename "$filename") sha256sum=$(sha256sum "../archives/${basename}.zip" | head -c 64) searchdir=$filename - fontdir=$(basename "$(dirname "$dirname")") MONOFONTS=() while IFS= read -d $'\0' -r file ; do @@ -111,7 +110,7 @@ do formattedbasename=$(echo "$basename" | tr "[:upper:]" "[:lower:]") - echo "$LINE_PREFIX Generating cask for: $fontdir" + echo "$LINE_PREFIX Generating cask for: $basename" [[ -d "$outputdir" ]] || mkdir -p "$outputdir" From 4c694029113a8f49dbc67b023b10a8e500f5b168 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 08:44:31 +0200 Subject: [PATCH 14/22] generate-casks: Fix separation of non-mono and mono fonts [why] The filter expects 'Mono' to be the last part of the font filename. With font-patcher's --makegroups that is not the case anymore, because in fact 'Mono' is part of the font name and the font filename ends in the style (i.e. 'Italic'). [how] Because we do only create 'Complete' fonts, and 'Mono' is always after 'Complete' (i.e. 'Complete Mono') for both veriants created by the font-patcher, we can use that to select mono fonts. [note] Also bump script version after several changes. Signed-off-by: Fini Jastrow --- bin/scripts/generate-casks.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index 8b8b2b47a..05aba28b8 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Nerd Fonts Version: 2.1.0 -# Script Version: 1.0.0 +# Script Version: 1.0.1 # Iterates over all patched fonts directories # to generate ruby cask files for homebrew-fonts (https://github.com/caskroom/homebrew-fonts) # only adds non-Windows versions of the fonts @@ -99,12 +99,12 @@ do MONOFONTS=() while IFS= read -d $'\0' -r file ; do MONOFONTS=("${MONOFONTS[@]}" "$file") - done < <(find "$searchdir" -type f -iwholename '*complete*' \( -iname '*.[o,t]tf' ! -wholename '*Windows*' -iname '*mono.*' \) -print0) + done < <(find "$searchdir" -type f -iwholename '*complete*' \( -iname '*.[o,t]tf' ! -wholename '*Windows*' -iname '*complete mono*' \) -print0) FONTS=() while IFS= read -d $'\0' -r file ; do FONTS=("${FONTS[@]}" "$file") - done < <(find "$searchdir" -type f -iwholename '*complete*' \( -iname '*.[o,t]tf' ! -wholename '*Windows*' ! -iwholename '*mono.*' \) -print0) + done < <(find "$searchdir" -type f -iwholename '*complete*' \( -iname '*.[o,t]tf' ! -wholename '*Windows*' ! -iname '*complete mono*' \) -print0) outputdir=$PWD/../casks/ From c292e7e8c62f45a51c172b909246e13cf39877bf Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 11:03:18 +0200 Subject: [PATCH 15/22] generate-fontconfig: Create sorted config [why] Even when the logical content does not change we will get a new commit on recreation because the order can/will be different. [how] Put the fonts in alphabetical order in the config file. Signed-off-by: Fini Jastrow --- bin/scripts/generate-fontconfig.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/scripts/generate-fontconfig.sh b/bin/scripts/generate-fontconfig.sh index e13f64c3f..ff66894b8 100755 --- a/bin/scripts/generate-fontconfig.sh +++ b/bin/scripts/generate-fontconfig.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Nerd Fonts Version: 2.1.0 -# Script Version: 1.0.0 +# Script Version: 1.0.1 # Iterates over all patched fonts directories # to generate a fontconfig based on the Nerd Fonts Symbols font # that contains only the glyphs @@ -41,7 +41,7 @@ echo "$LINE_PREFIX Generating fontconfig for: monospace" } >> "$to" #find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font -find . -maxdepth 1 -type d | # uncomment to get all fonts +find . -maxdepth 1 -type d | sort | # uncomment to get all fonts while read -r filename do From 967036e7310bcadb518e657f404b03a4357a1d7b Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 08:59:23 +0200 Subject: [PATCH 16/22] CI: Fix fontconfig and casks [why] The fontconfig and cask generation seems unfinished or broken. [how] Fix the point in time when the fontconfig is generated and commit any changes back to the repo. Generate the casks and store them as CI artifacts at least. Probably they should be uploaded to the cask repo (on 'real' releases)? Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2a8c463e..80b12d688 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -196,17 +196,18 @@ jobs: fontforge --script `pwd`/../../font-patcher --version ./gotta-patch-em-all-font-patcher\!.sh "/${{ matrix.font }}" - - name: Generate fontconfig and casks - run: | - cd -- "$GITHUB_WORKSPACE/bin/scripts" - ./generate-fontconfig.sh - ./generate-casks.sh "${{ matrix.font }}" - - name: Archive font package zip files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" ./archive-fonts.sh "${{ matrix.font }}" + - name: Generate cask + # The casks are not used at the moment, but probably Ryan + # wanted to push them out somewhere + run: | + cd -- "$GITHUB_WORKSPACE/bin/scripts" + ./generate-casks.sh "${{ matrix.font }}" + - name: Upload zip file archive for release uses: softprops/action-gh-release@v0.1.14 if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' @@ -225,6 +226,16 @@ jobs: patched-fonts/${{ matrix.font }} LICENSE + - name: Upload casks as artifacts + uses: actions/upload-artifact@v2 + with: + name: casks + # adding multiple paths (i.e. LICENSE) is a workaround to get a least common ancestor + # of the root directory for artifact path purposes + path: | + casks/${{ matrix.font }} + LICENSE + release-font-patcher: name: Archive font patcher and add to release needs: [ setup-fonts-matrix, build ] @@ -303,6 +314,19 @@ jobs: committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com + - name: Generate fontconfig + run: | + cd -- "$GITHUB_WORKSPACE/bin/scripts" + ./generate-fontconfig.sh + + - name: Commit fontconfig back to repo + uses: EndBug/add-and-commit@v9 + with: + add: '10-nerd-font-symbols.conf' + message: Regenerate fontconfig + committer_name: GitHub Actions + committer_email: 41898282+github-actions[bot]@users.noreply.github.com + - name: Adjust release tag to include previous commit uses: EndBug/latest-tag@v1.5.0 if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' From 3c78eb7f09b96dfd374efbf7d09b7d69af42a8d6 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 12:51:27 +0200 Subject: [PATCH 17/22] CI: Make commits from the action stand out more Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80b12d688..63a475153 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -302,7 +302,7 @@ jobs: uses: EndBug/add-and-commit@v9 with: add: "['font-patcher', 'bin/scripts']" - message: Bump release version + message: "[ci] Bump release version" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com @@ -310,7 +310,7 @@ jobs: uses: EndBug/add-and-commit@v9 with: add: 'patched-fonts' - message: Rebuilds patched fonts + message: "[ci] Rebuilds patched fonts" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com @@ -323,7 +323,7 @@ jobs: uses: EndBug/add-and-commit@v9 with: add: '10-nerd-font-symbols.conf' - message: Regenerate fontconfig + message: "[ci] Regenerate fontconfig" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com From 039f5baffe150d3c388b0491c618a12ad3ef6706 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 14:03:34 +0200 Subject: [PATCH 18/22] CI: Allow releases on package.json change [why] The release workflow is triggered on a lot occasions, but not on changes of the package.json file. But that file contains our version number and when we change it we should create a new release. At least is that how I would imagine it working. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63a475153..8af98d2c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,6 @@ on: - 'install.ps1' - 'install.sh' - 'LICENSE' - - 'package**' # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From e972eb0785b4ac47f5a1531d85d923da57880091 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 25 Aug 2022 14:16:31 +0200 Subject: [PATCH 19/22] CI: Prepend release tags with a "v" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [why] Usually release tags and versions start with a "v", and we also had that up to 2.1.0: $ git tag -l 2.2.0-RC FontPatcher v0.1.0 v0.1.1 v0.1.2 v0.2.0 v0.2.1 v0.3.0 v0.3.1 v0.4.0 v0.4.1 v0.5.0 v0.5.1 v0.6.0 v0.6.1 v0.7.0 v0.8.0 v1.0.0 v1.1.0 v1.2.0 v2.0.0 v2.1.0 [how] In the files we keep the non-"v" version numbers, but the tags on github shall be prepended with a "v" like "v2.2.0-RC". The variable RELEASE_TAG_VERSION is renamed to RELEASE_VERSION to make clear that this is not the name of the tag. Where we reference a tag, "v$RELEASE_VERSION" is used. [note] One of the environment variable is not needed, we can use the output directly. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8af98d2c7..0ea7bdccb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,18 +48,17 @@ jobs: cd -- "$GITHUB_WORKSPACE" echo "Contents of package.json:" cat package.json - RELEASE_TAG_VERSION=$(cat package.json \ + RELEASE_VERSION=$(cat package.json \ | grep version \ | head -1 \ | awk -F: '{ print $2 }' \ | sed 's/[ ",]//g') - echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV - echo "::set-output name=val::$RELEASE_TAG_VERSION" + echo "::set-output name=val::$RELEASE_VERSION" - name: Determine candidate status id: rel_can run: | - [[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false" + [[ "${{ steps.rel_ver.outputs.val }}" == *"-RC"* ]] && echo "::set-output name=val::true" || echo "::set-output name=val::false" - name: Determine new release or re-release # If the tag exists it is obviously a re-release @@ -67,12 +66,12 @@ jobs: # This would need a complete checkout, that we want to avoid # uses: mukunku/tag-exists-action@v1.0.0 # with: - # tag: "${{ env.RELEASE_TAG_VERSION }}" + # tag: "v${{ steps.rel_ver.outputs.val }}" # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} id: rel_pre_existing run: | - curl -v "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/tags" | jq '.[].name' | grep '^"${{ steps.rel_ver.outputs.val }}"$' \ + curl -v "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/tags" | jq '.[].name' | grep '^"v${{ steps.rel_ver.outputs.val }}"$' \ && echo "::set-output name=exists::true" || echo "::set-output name=exists::false" echo "Tag exists: ${{ steps.rel_pre_existing.outputs.exists }}" @@ -108,7 +107,7 @@ jobs: env: GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} strategy: @@ -120,7 +119,7 @@ jobs: - uses: actions/checkout@v3 - name: Check release variables run: | - echo "$RELEASE_TAG_VERSION" + echo "$RELEASE_VERSION" echo "Candidate: $RELEASE_CANDIDATE" echo "Publish/refresh release: ${{ needs.setup-fonts-matrix.outputs.rel_upload }}" @@ -182,7 +181,7 @@ jobs: - name: Bump version for source files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" - ./version-bump.sh "$RELEASE_TAG_VERSION" + ./version-bump.sh "$RELEASE_VERSION" - name: Standardize the readme files run: | @@ -212,7 +211,7 @@ jobs: if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} - tag_name: ${{ env.RELEASE_TAG_VERSION }} + tag_name: "v${{ env.RELEASE_VERSION }}" files: archives/* - name: Upload patched fonts as artifacts @@ -242,7 +241,7 @@ jobs: env: GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} runs-on: ubuntu-latest @@ -251,7 +250,7 @@ jobs: - name: Bump version for source files run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" - ./version-bump.sh "$RELEASE_TAG_VERSION" + ./version-bump.sh "$RELEASE_VERSION" - name: Archive font-patcher script for release run: | @@ -263,7 +262,7 @@ jobs: if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: prerelease: ${{ env.RELEASE_CANDIDATE != 'false' }} - tag_name: ${{ env.RELEASE_TAG_VERSION }} + tag_name: "v${{ env.RELEASE_VERSION }}" files: archives/* commit: @@ -286,11 +285,11 @@ jobs: - name: Bump version for source files env: - RELEASE_TAG_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + RELEASE_VERSION: ${{ needs.setup-fonts-matrix.outputs.rel_version }} RELEASE_CANDIDATE: ${{ needs.setup-fonts-matrix.outputs.rel_candidate }} run: | cd -- "$GITHUB_WORKSPACE/bin/scripts" - ./version-bump.sh "$RELEASE_TAG_VERSION" + ./version-bump.sh "$RELEASE_VERSION" - name: Commit version bump changes # If there are no changes (i.e. we already have that bump commit from a previous run) @@ -330,4 +329,4 @@ jobs: uses: EndBug/latest-tag@v1.5.0 if: needs.setup-fonts-matrix.outputs.rel_upload == 'true' with: - ref: ${{ needs.setup-fonts-matrix.outputs.rel_version }} + ref: "v${{ needs.setup-fonts-matrix.outputs.rel_version }}" From a777d53008aa05ed1a8e61461cbb753bf4eaf9a4 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 26 Aug 2022 07:33:56 +0200 Subject: [PATCH 20/22] CI: Use jq to process package.json [why] `grep` and `awk` do not know json. This might break if some format changes or whatever. [note] The font matrix setup is also with `jq`. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ea7bdccb..74994eabd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,11 +48,7 @@ jobs: cd -- "$GITHUB_WORKSPACE" echo "Contents of package.json:" cat package.json - RELEASE_VERSION=$(cat package.json \ - | grep version \ - | head -1 \ - | awk -F: '{ print $2 }' \ - | sed 's/[ ",]//g') + RELEASE_VERSION=$(jq '.version' package.json | sed 's/[ ",]//g') echo "::set-output name=val::$RELEASE_VERSION" - name: Determine candidate status From 43b5af62718308ccc4af13e86ff21d4c8d5a84e7 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 26 Aug 2022 10:52:36 +0200 Subject: [PATCH 21/22] CI: Fix docker release trigger [why] The docker image should be rebuilt whenever a file that will end up in the container has been changed. So this needs to be in line with the .dockerignore file. [how] Add missing (new) `font-patcher` sub-scripts. Signed-off-by: Fini Jastrow --- .dockerignore | 1 + .github/workflows/docker-release.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.dockerignore b/.dockerignore index 72a9edbca..2d68d42c7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ +# Keep this in line with .github/workflows/docker-release.yml ** !src/glyphs !font-patcher diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 26bc48512..4777afde8 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -5,7 +5,9 @@ on: branches: - master paths: + # Keep this in line with .dockerignore - bin/scripts/docker-entrypoint.sh + - bin/scripts/name_parser/Fontname*.py - src/glyphs/** - .dockerignore - Dockerfile From 1d6aa1748d8e731c8e7fcafb4258be553a283a48 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 26 Aug 2022 10:54:36 +0200 Subject: [PATCH 22/22] CI: Prevent docker release when hopeless [why] On forks for example they might have a docker repo associated or not. The release process is run in any case and will fail in that cases. [how] Check that at least the secret is known. Signed-off-by: Fini Jastrow --- .github/workflows/docker-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 4777afde8..1898da641 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -17,6 +17,7 @@ jobs: publish-image: name: Publish image runs-on: ubuntu-latest + if: ${{ secrets.DOCKER_USER }} steps: - uses: actions/checkout@v3 - name: Build image