Skip to content

Commit 45b65b6

Browse files
committed
ci: use npm for publishing
1 parent b44271f commit 45b65b6

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.github/workflows/create-release-on-github.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
permissions:
1212
id-token: write # Required for OIDC
13-
contents: read
13+
contents: write
1414

1515
jobs:
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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": "Josh Kasten, Brad Hesse, Rodrigo Gomez-Palacio",
55
"repository": {
66
"type": "git",
7-
"url": "git+https://github.com/onesignal/OneSignal-Cordova-SDK.git"
7+
"url": "git+https://github.com/OneSignal/OneSignal-Cordova-SDK.git"
88
},
99
"type": "module",
1010
"types": "dist/index.d.ts",
@@ -36,7 +36,7 @@
3636
},
3737
"main": "dist/index.js",
3838
"bugs": {
39-
"url": "https://github.com/onesignal/OneSignal-Cordova-SDK/issues"
39+
"url": "https://github.com/OneSignal/OneSignal-Cordova-SDK/issues"
4040
},
4141
"cordova": {
4242
"id": "onesignal-cordova-plugin",
@@ -70,7 +70,7 @@
7070
"version": ">=4.3.0"
7171
}
7272
],
73-
"homepage": "https://github.com/onesignal/OneSignal-Cordova-SDK#readme",
73+
"homepage": "https://github.com/OneSignal/OneSignal-Cordova-SDK#readme",
7474
"keywords": [
7575
"push",
7676
"notification",

0 commit comments

Comments
 (0)