From 5eebd9545635cdf6b2b2a9f3cf81c222b65b2a89 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 2 Jun 2023 19:28:55 +0200 Subject: [PATCH] fetch-archives: Allow to specify a regex [why] Now where we have zip and tar.xz archives one might want to just fetch one specific one. So we need to have a pattern not only for the beginning of the file name. [how] Enable full regexes for the filtering. For this we need to escape blanks in the pattern/regex, that a user might specify (./fetch-archive.sh v2.2.2 'Some Font'). [note] This is already then used for the casks workflow, as that only needs the zips. Signed-off-by: Fini Jastrow --- .github/workflows/casks.yml | 2 +- bin/scripts/fetch-archives.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/casks.yml b/.github/workflows/casks.yml index 4cb96356c..f78099d06 100644 --- a/.github/workflows/casks.yml +++ b/.github/workflows/casks.yml @@ -23,7 +23,7 @@ jobs: run: | cd bin/scripts chmod u+x * - ./fetch-archives.sh latest + ./fetch-archives.sh latest '*zip' - name: Determine release tag id: releasetag run: | diff --git a/bin/scripts/fetch-archives.sh b/bin/scripts/fetch-archives.sh index 5ce9984bb..55b7064e8 100755 --- a/bin/scripts/fetch-archives.sh +++ b/bin/scripts/fetch-archives.sh @@ -15,6 +15,7 @@ # fetch-archives v2.2.2 # fetch-archives v2.2.2 Heavy # fetch-archives latest HeavyDat +# fetch-archives v3.1.0 'Ara.*zip' (just fetch the zip archive) set -e @@ -54,8 +55,8 @@ fi echo "${LINE_PREFIX} Found ${num} artifacts" if [ $# -ge 2 ]; then - pattern=$2 - echo "${LINE_PREFIX} Limiting archive to pattern '${pattern}'" + pattern=${2// /\\ } + echo "${LINE_PREFIX} Limiting archive to regex '${pattern}'" else pattern="" echo "${LINE_PREFIX} No limiting pattern given" @@ -67,7 +68,7 @@ fi for assetname in "${files[@]}"; do assetname=${assetname:1:-1} - if [[ ! "${assetname}" =~ ^"${pattern}" ]]; then + if [[ ! "${assetname}" =~ ${pattern} ]]; then continue fi echo >&2 "${LINE_PREFIX} Fetching ${versiontag}/${assetname}"