Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,23 @@ jobs:
run: ls -R ./npm
shell: bash
working-directory: ./nodejs
# npm refuses to publish over an existing version (E403), so a re-run of
# the release (e.g. to retry a different SDK's publish) would fail here.
# Skip when this version is already published. Only the main package is
# checked: it is published last, after every platform package.
- name: Check if version already on npm
run: |
version=$(node -p "require('./package.json').version")
if [ -n "$(npm view "longbridge@${version}" version 2>/dev/null)" ]; then
echo "longbridge ${version} already on npm; skipping publish."
echo "NPM_EXISTS=true" >> $GITHUB_ENV
else
echo "longbridge ${version} not found on npm; will publish."
echo "NPM_EXISTS=false" >> $GITHUB_ENV
fi
working-directory: ./nodejs
- name: Publish
if: env.NPM_EXISTS != 'true'
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
Expand Down
Loading