1010
1111permissions :
1212 id-token : write # Required for OIDC
13- contents : read
13+ contents : write
1414
1515jobs :
1616 publish-to-npm :
@@ -28,14 +28,24 @@ jobs:
2828 fetch-depth : 0
2929 fetch-tags : true
3030
31+ # for installation of dependencies
3132 - name : Setup Bun
3233 uses : oven-sh/setup-bun@v2
3334 with :
3435 bun-version : latest
3536 registry-url : ' https://registry.npmjs.org'
3637
37- - name : Install
38- run : bun install --frozen-lockfile
38+ - name : Install & Build
39+ run : |
40+ bun install --frozen-lockfile
41+ bun run build
42+
43+ # for publishing
44+ - name : Setup Node
45+ uses : actions/setup-node@v6
46+ with :
47+ node-version : ' 24'
48+ registry-url : ' https://registry.npmjs.org'
3949
4050 - name : Get version
4151 id : get_version
@@ -49,17 +59,20 @@ jobs:
4959 fi
5060 echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
5161
52- - name : Build & Publish
62+ - name : Publish
5363 run : |
54- bun run build
55-
5664 VERSION='${{ steps.get_version.outputs.version }}'
57- if [[ $VERSION =~ alpha ]]; then
58- bun publish --tag alpha
59- elif [[ $VERSION =~ beta ]]; then
60- bun publish --tag beta
65+ # Check if version already exists on npm
66+ if npm view onesignal-cordova-plugin@$VERSION > /dev/null 2>&1; then
67+ echo "Version $VERSION already published, skipping publish"
6168 else
62- bun publish
69+ if [[ $VERSION =~ alpha ]]; then
70+ npm publish --tag alpha
71+ elif [[ $VERSION =~ beta ]]; then
72+ npm publish --tag beta
73+ else
74+ npm publish
75+ fi
6376 fi
6477
6578 - name : Create release notes
0 commit comments