CI: Fix validate-npm-packages regex to work without version suffix (#76838)

Fix validate-npm-packages regex to work without suffix
This commit is contained in:
Guilherme Caulada 2023-10-19 17:06:00 -03:00 committed by GitHub
parent 6cb5e0806e
commit d29af5ec08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ ARTIFACTS_DIR="./npm-artifacts"
for file in "$ARTIFACTS_DIR"/*.tgz; do
echo "🔍 Checking NPM package: $file"
# get filename then strip everything after package name.
dir_name=$(basename "$file" .tgz | sed 's/^@\(.*\)-[0-9]*[.]*[0-9]*[.]*[0-9]*-\([0-9]*[a-zA-Z]*\)/\1/')
dir_name=$(basename "$file" .tgz | sed -E 's/@([a-zA-Z0-9-]+)-[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-]+)?/\1/')
mkdir -p "./npm-artifacts/$dir_name"
tar -xzf "$file" -C "./npm-artifacts/$dir_name" --strip-components=1