Skip to content

Commit f23541f

Browse files
authored
fix: safely rerun actions (#521)
1 parent 41d5a8d commit f23541f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/publish.reusable.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,16 @@ jobs:
4747
if: inputs.is-prerelease != 'true'
4848
run: |
4949
for package in packages/@postgrestools/*; do
50-
npm publish "$package" --tag latest --access public --provenance
50+
package_basename=$(basename "$package")
51+
package_name="@postgrestools/$package_basename"
52+
package_version="${{ inputs.release-tag }}"
53+
54+
if npm view "$package_name@$package_version" version 2>/dev/null; then
55+
echo "Package $package_name@$package_version already exists, skipping..."
56+
else
57+
echo "Publishing $package_name@$package_version..."
58+
npm publish "$package" --tag latest --access public --provenance
59+
fi
5160
done
5261
env:
5362
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)