Skip to content

Commit f0d310f

Browse files
committed
ci: [SDK-4198] add reusable Vite+ wrapper SDK workflow (#23)
1 parent 9f718ab commit f0d310f

2 files changed

Lines changed: 52 additions & 13 deletions

File tree

.github/workflows/publish-npm-github.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
JSON array of package scopes/names to publish (e.g., '["com.onesignal.unity.core", "com.onesignal.unity.android"]')
1717
If empty, publishes the root package.json
1818
default: "[]"
19+
toolchain:
20+
required: false
21+
type: string
22+
description: Toolchain to use for install & build ("bun" or "vite-plus")
23+
default: bun
1924
secrets:
2025
GH_PUSH_TOKEN:
2126
required: false
@@ -39,19 +44,29 @@ jobs:
3944
token: ${{ secrets.GITHUB_TOKEN }}
4045
ref: ${{ inputs.branch }}
4146

42-
# Bun for installing dependencies and building
4347
- name: Setup Bun
48+
if: inputs.toolchain == 'bun'
4449
uses: oven-sh/setup-bun@v2
4550
with:
4651
bun-version: latest
4752

48-
- name: Install & Build
53+
- name: Setup Vite+
54+
if: inputs.toolchain == 'vite-plus'
55+
uses: voidzero-dev/setup-vp@v1
56+
with:
57+
cache: yes
58+
run-install: true
59+
60+
- name: Install & Build (Bun)
61+
if: inputs.toolchain == 'bun'
4962
run: |
5063
bun install --frozen-lockfile
5164
bun run build
5265
53-
# Can't use Bun yet for publishing to NPM via OIDC, so we use Node.js
54-
# for publishing
66+
- name: Build (Vite+)
67+
if: inputs.toolchain == 'vite-plus'
68+
run: vp pack
69+
5570
- name: Setup Node
5671
uses: actions/setup-node@v6
5772
with:
@@ -61,8 +76,8 @@ jobs:
6176
- name: Get version
6277
id: get_version
6378
run: |
64-
CURRENT_VERSION=$(bun -e "console.log(require('./package.json').version)")
65-
PACKAGE_NAME=$(bun -e "console.log(require('./package.json').name)")
79+
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
80+
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)")
6681
if git rev-parse "$CURRENT_VERSION" >/dev/null 2>&1; then
6782
echo "Tag $CURRENT_VERSION already exists, nothing to do"
6883
exit 0
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CI workflow for JavaScript-based wrapper SDKs (Cordova-Ionic/React Native)
2-
# Sets up JDK, Homebrew, Clang, Bun, then runs lint and tests
2+
# Sets up JDK, Clang, and either Bun or Vite+ (vp), then runs lint and tests
33
name: Wrapper JS CI
44

55
on:
@@ -10,20 +10,25 @@ on:
1010
type: string
1111
description: Java version to use
1212
default: "17"
13+
toolchain:
14+
required: false
15+
type: string
16+
description: Toolchain to use for install, lint & test ("bun" or "vite-plus")
17+
default: bun
1318
bun_version:
1419
required: false
1520
type: string
16-
description: Bun version to use
21+
description: Bun version to use (only when toolchain is "bun")
1722
default: latest
1823

1924
jobs:
2025
ci:
2126
runs-on: ubuntu-latest
2227
steps:
2328
- name: Checkout
24-
uses: actions/checkout@v5
29+
uses: actions/checkout@v6
2530

26-
- name: Set up JDK 17
31+
- name: Set up JDK
2732
uses: actions/setup-java@v4
2833
with:
2934
java-version: ${{ inputs.java_version }}
@@ -33,15 +38,34 @@ jobs:
3338
uses: OneSignal/actions/.github/actions/setup-clang@main
3439

3540
- name: Set up Bun
41+
if: inputs.toolchain == 'bun'
3642
uses: oven-sh/setup-bun@v2
3743
with:
3844
bun-version: ${{ inputs.bun_version }}
3945

40-
- name: Install
46+
- name: Install (Bun)
47+
if: inputs.toolchain == 'bun'
4148
run: bun install --frozen-lockfile
4249

43-
- name: Linting
50+
- name: Set up Vite+
51+
if: inputs.toolchain == 'vite-plus'
52+
uses: voidzero-dev/setup-vp@v1
53+
with:
54+
cache: true
55+
run-install: true
56+
57+
- name: Linting (Bun)
58+
if: inputs.toolchain == 'bun'
4459
run: bun run lint
4560

46-
- name: Tests
61+
- name: Linting (Vite+)
62+
if: inputs.toolchain == 'vite-plus'
63+
run: vp run lint
64+
65+
- name: Tests (Bun)
66+
if: inputs.toolchain == 'bun'
4767
run: bun run test:coverage
68+
69+
- name: Tests (Vite+)
70+
if: inputs.toolchain == 'vite-plus'
71+
run: vp run test

0 commit comments

Comments
 (0)