Skip to content

Commit 7ab2960

Browse files
fix: npm action should pull name from package.json (#526)
1 parent fdbf60a commit 7ab2960

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/publish.reusable.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ jobs:
2626
node-version: lts/*
2727
registry-url: "https://registry.npmjs.org"
2828

29+
- name: Verify `jq` is installed
30+
run: |
31+
if ! jq --version 2>/dev/null; then
32+
echo "jq not installed, required for extracting package names."
33+
exit 1
34+
fi
35+
2936
- name: Generate Packages
3037
id: generate-packages
3138
run: node packages/@postgrestools/postgrestools/scripts/generate-packages.mjs
@@ -48,11 +55,12 @@ jobs:
4855
run: |
4956
for package in packages/@postgrestools/*; do
5057
version="${{ inputs.release-tag }}"
58+
npm_package_name=$(jq -r ".name" "$package/package.json")
5159
52-
if npm view "$package@$version" version 2>/dev/null; then
53-
echo "Package $package@$version already exists, skipping..."
60+
if npm view "$npm_package_name@$version" version 2>/dev/null; then
61+
echo "Package $npm_package_name@$version already exists, skipping..."
5462
else
55-
echo "Publishing $package@$version..."
63+
echo "Publishing $npm_package_name@$version..."
5664
npm publish "$package" --tag latest --access public --provenance
5765
fi
5866
done

0 commit comments

Comments
 (0)