File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 2323 uses : actions/setup-node@v4
2424 with :
2525 node-version : lts/*
26- cache : " yarn"
26+ cache : ' yarn'
2727 registry-url : ' https://registry.npmjs.org'
2828
2929 - name : Install yarn dependencies
@@ -35,13 +35,21 @@ jobs:
3535 - name : Test
3636 run : yarn test
3737
38- - name : Publish
38+ - name : Check version and publish
3939 run : |
40- VERSION=$(node -p "require('./package.json').version" )
41- if [[ "$VERSION" =~ (rc) ]]; then
40+ PACKAGE_NAME=$(node -p "require('./package.json').name")
41+ CURRENT_VERSION=$(node -p "require('./package.json').version")
42+
43+ # Check if version exists in npm registry
44+ if npm view "${PACKAGE_NAME}@${CURRENT_VERSION}" version &>/dev/null; then
45+ echo "Version $CURRENT_VERSION already published, skipping"
46+ exit 0
47+ fi
48+
49+ if [[ "$CURRENT_VERSION" =~ (rc) ]]; then
4250 yarn publish:rc
4351 else
4452 yarn publish:latest
4553 fi
4654 env :
47- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
55+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments