From f4203731c15a1cbd9bc1e0d28ca76b52fee189f7 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Thu, 16 May 2024 08:43:52 +0200 Subject: [PATCH] CI: Adapt Homebrew Cask generation [why] The Cask-fonts repo has been incorporated into the main Cask repo. On releases we would use an obsolete repository to create the Cask into. The casks are now in a dedicated subdirectory (Casks/font) and under that we have one subdirectory for each font name starting character (to have a smaller number of files per directory I assume). [how] Change the repository path. Put part of the new (longer) path, the fixed part, just in the CI process, while the generator script takes care about the one-directory-per-startchar substructure. Fixes: #1635 Signed-off-by: Fini Jastrow --- .github/workflows/casks.yml | 8 ++++---- bin/scripts/generate-casks.sh | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/casks.yml b/.github/workflows/casks.yml index eb274e0bfc..428c9a67be 100644 --- a/.github/workflows/casks.yml +++ b/.github/workflows/casks.yml @@ -1,8 +1,8 @@ name: Create Casks PR env: - HOMEBREW_REPO: Homebrew/homebrew-cask-fonts - HOMEBREW_FORK: Finii/homebrew-cask-fonts + HOMEBREW_REPO: Homebrew/homebrew-cask + HOMEBREW_FORK: Finii/homebrew-cask FORK_USER: Finii FORK_TOKEN: tvguho_cng_11NQ2SVID0Zkry5DgnaDc4_b4dFDpJJ3iyA6vzzGgZApZEkF6HacnnfO6Mp4OEw81IFBWGAFCM0qevtz5t @@ -72,13 +72,13 @@ jobs: path: casks - name: Prepare changes run: | - cp casks/* homebrew/Casks + cp -r casks/* homebrew/Casks/font - name: Commit changes uses: EndBug/add-and-commit@v9 with: cwd: homebrew fetch: false - add: Casks + add: Casks/font message: "[ci] Update Nerd Font casks to ${{ needs.create-casks.outputs.tag }}" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index ca06c1cb93..49ccb8b117 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash # Nerd Fonts Version: 3.3.0 -# Script Version: 2.2.3 +# Script Version: 2.3.0 # # Iterates over all [*] archived fonts -# to generate ruby cask files for homebrew-fonts (https://github.com/Homebrew/homebrew-cask-fonts) -# * Only adds non-Windows versions of the fonts +# to generate ruby cask files for homebrew-fonts (https://github.com/Homebrew/homebrew-cask) # * Needs the zip archives in archives/ (i.e. run `./archive-fonts.sh` first) # # Uses the current release version (including drafts) of the repo. @@ -236,14 +235,12 @@ while read -r filename; do FONTS=("${FONTS[@]}" "$file") done < <(find "$searchdir" -type f -iname '*.[ot]tf' -print0 | LC_ALL=C sort -z) - outputdir=$PWD/../casks - echo "$LINE_PREFIX Generating cask for: $basename" - [[ -d "$outputdir" ]] || mkdir -p "$outputdir" - caskname="font-${caskbasename}-nerd-font" - to="$outputdir/${caskname}.rb" + outputdir="${PWD}/../casks/${caskname:0:6}" + [[ -d "$outputdir" ]] || mkdir -p "$outputdir" + to="${outputdir}/${caskname}.rb" clear_file "$to" write_header "$to" "$caskname"