Skip to content

Commit d4eb88f

Browse files
Release 160601 (#1438)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Fadi George <[email protected]>
1 parent f31487b commit d4eb88f

File tree

6 files changed

+58
-116
lines changed

6 files changed

+58
-116
lines changed

.github/workflows/cd.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build SDK Files & GCS Upload
1+
name: Build, Deploy & Create GitHub Release
22

33
on:
44
push:
@@ -8,6 +8,9 @@ on:
88
- '**.md'
99
workflow_dispatch:
1010

11+
permissions:
12+
contents: write
13+
1114
jobs:
1215
check_release:
1316
runs-on: ubuntu-latest
@@ -23,52 +26,73 @@ jobs:
2326
/Release \d{6}/.test(context.payload.head_commit.message);
2427
core.setOutput('should_run', shouldRun);
2528
26-
test_build_deploy:
29+
build_deploy:
30+
name: Build & Deploy
2731
runs-on: ubuntu-latest
2832
needs: check_release
2933
if: needs.check_release.outputs.should_run == 'true'
34+
outputs:
35+
version: ${{ steps.get_version.outputs.version }}
3036
steps:
3137
- name: Checkout
3238
uses: actions/checkout@v5
39+
with:
40+
fetch-depth: 0
41+
token: ${{ secrets.GITHUB_TOKEN }}
3342

34-
- name: Bun Setup
43+
- name: Setup Bun
3544
uses: oven-sh/setup-bun@v2
3645
with:
3746
bun-version: latest
3847

39-
- name: 'Install'
40-
run: bun install
48+
- name: Install
49+
run: bun install --frozen-lockfile
4150

42-
- name: 'Build for Staging'
51+
- name: Build for Staging
4352
run: bun run build:staging
4453

45-
- name: 'Build for Production'
54+
- name: Build for Production
4655
run: bun run build:prod
4756

48-
- name: 'Authenticate to Google Cloud'
49-
uses: 'google-github-actions/auth@v1'
57+
- name: Authenticate to Google Cloud
58+
uses: google-github-actions/auth@v1
5059
with:
5160
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
5261

53-
- name: 'Upload SDK Files to GCS'
54-
uses: 'google-github-actions/upload-cloud-storage@v1'
62+
- name: Upload SDK Files to GCS
63+
uses: google-github-actions/upload-cloud-storage@v1
5564
with:
5665
path: 'build/releases'
5766
destination: 'sdk-builds-persistence-onesignal/web-sdk/${{ github.sha }}'
5867
parent: false
5968

60-
- name: 'Get SDK Version'
69+
- name: Get version
6170
id: get_version
62-
run: echo "SDK_VERSION=$(bun -e "console.log(require('./package.json').config.sdkVersion)")" >> $GITHUB_OUTPUT
71+
run: |
72+
VERSION=$(bun -e "console.log(require('./package.json').version)")
73+
SDK_VERSION=$(bun -e "console.log(require('./package.json').config.sdkVersion)")
74+
if git rev-parse "$VERSION" >/dev/null 2>&1; then
75+
echo "Tag $VERSION already exists, skipping release"
76+
else
77+
echo "version=$VERSION" >> $GITHUB_OUTPUT
78+
echo "sdk_version=$SDK_VERSION" >> $GITHUB_OUTPUT
79+
fi
6380
64-
- name: 'Create turbine pr'
81+
- name: Create turbine PR
82+
if: steps.get_version.outputs.version != ''
6583
run: ./build/scripts/turbine.sh
6684
env:
6785
GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }}
6886
GITHUB_SHA: ${{ github.sha }}
6987
GITHUB_RUN_ID: ${{ github.run_id }}
70-
SDK_VERSION: ${{ steps.get_version.outputs.SDK_VERSION }}
88+
SDK_VERSION: ${{ steps.get_version.outputs.sdk_version }}
7189

72-
create_release:
73-
needs: test_build_deploy
74-
uses: ./.github/workflows/create-release-on-github.yml
90+
create_github_release:
91+
name: Create GitHub Release
92+
needs: build_deploy
93+
if: needs.build_deploy.outputs.version != ''
94+
uses: OneSignal/sdk-shared/.github/workflows/github-release.yml@main
95+
secrets:
96+
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
97+
with:
98+
version: ${{ needs.build_deploy.outputs.version }}

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

Lines changed: 0 additions & 78 deletions
This file was deleted.

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
"build:sdk": "LIB=sdk vite build",
1515
"build:page": "LIB=page vite build",
1616
"build:sw": "LIB=worker vite build",
17-
"build": "npm run build:sdk && npm run build:page && npm run build:sw",
17+
"build": "bun run build:sdk && bun run build:page && bun run build:sw",
1818
"build:watch": "LIB=sdk vite build --watch",
19-
"build:dev": "ENV=development npm run build",
19+
"build:dev": "ENV=development bun run build",
2020
"build:dev:watch": "ENV=development concurrently \"LIB=sdk vite build --watch\" \"LIB=page vite build --watch\" \"LIB=worker vite build --watch\"",
21-
"build:staging": "ENV=staging BUILD_ORIGIN=staging.onesignal.com API=staging API_ORIGIN=staging.onesignal.com npm run build",
22-
"build:staging:watch": "ENV=staging BUILD_ORIGIN=staging.onesignal.com API=staging API_ORIGIN=staging.onesignal.com npm run build:watch",
23-
"build:prod": "ENV=production API=production npm run build && size-limit",
24-
"build:prod:watch": "ENV=production API=production npm run build:watch",
25-
"postbuild:prod": "npm run validate:build",
26-
"build:dev-dev": "API=development npm run build:dev",
27-
"build:dev-dev:watch": "API=development npm run build:dev:watch",
28-
"build:dev-prod": "API=production API_ORIGIN=onesignal.com npm run build:dev",
29-
"build:dev-prod:watch": "API=production API_ORIGIN=onesignal.com npm run build:dev:watch",
30-
"build:dev-stag": "API=staging API_ORIGIN=onesignal.com npm run build:dev",
31-
"build:dev-stag:watch": "API=staging API_ORIGIN=onesignal.com npm run build:dev:watch",
21+
"build:staging": "ENV=staging BUILD_ORIGIN=staging.onesignal.com API=staging API_ORIGIN=staging.onesignal.com bun run build",
22+
"build:staging:watch": "ENV=staging BUILD_ORIGIN=staging.onesignal.com API=staging API_ORIGIN=staging.onesignal.com bun run build:watch",
23+
"build:prod": "ENV=production API=production bun run build && size-limit",
24+
"build:prod:watch": "ENV=production API=production bun run build:watch",
25+
"postbuild:prod": "bun run validate:build",
26+
"build:dev-dev": "API=development bun run build:dev",
27+
"build:dev-dev:watch": "API=development bun run build:dev:watch",
28+
"build:dev-prod": "API=production API_ORIGIN=onesignal.com bun run build:dev",
29+
"build:dev-prod:watch": "API=production API_ORIGIN=onesignal.com bun run build:dev:watch",
30+
"build:dev-stag": "API=staging API_ORIGIN=onesignal.com bun run build:dev",
31+
"build:dev-stag:watch": "API=staging API_ORIGIN=onesignal.com bun run build:dev:watch",
3232
"test": "vitest run --coverage",
3333
"test:watch": "vitest watch --coverage",
34-
"validate:build": "node build/scripts/validate.js",
34+
"validate:build": "bun build/scripts/validate.js",
3535
"lint": "oxlint src; prettier --check 'src/**/*' '__test__/**/*'",
3636
"lint:fix": "oxlint src --fix; prettier --write 'src/**/*' '__test__/**/*'"
3737
},
3838
"config": {
39-
"sdkVersion": "160600"
39+
"sdkVersion": "160601"
4040
},
4141
"repository": {
4242
"type": "git",
@@ -77,7 +77,7 @@
7777
},
7878
{
7979
"path": "./build/releases/OneSignalSDK.page.es6.js",
80-
"limit": "43.701 kB",
80+
"limit": "43.69 kB",
8181
"gzip": true
8282
},
8383
{

src/core/executors/SubscriptionOperationExecutor.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ describe('SubscriptionOperationExecutor', () => {
553553
identity: {
554554
onesignal_id: ONESIGNAL_ID,
555555
},
556-
retain_previous_owner: false,
557556
});
558557
});
559558

src/core/executors/SubscriptionOperationExecutor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ export class SubscriptionOperationExecutor implements IOperationExecutor {
275275
{ appId: op._appId },
276276
op._subscriptionId,
277277
{ onesignal_id: op._onesignalId },
278-
false,
279278
);
280279

281280
if (response.ok) {

src/core/requests/api.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,12 @@ export async function transferSubscriptionById(
252252
requestMetadata: RequestMetadata,
253253
subscriptionId: string,
254254
identity: IUserIdentity,
255-
retainPreviousOwner: boolean,
256255
) {
257256
const { appId } = requestMetadata;
258257
return OneSignalApiBase.patch<{ identity: IUserIdentity }>(
259258
`apps/${appId}/subscriptions/${subscriptionId}/owner`,
260259
{
261260
identity: { ...identity },
262-
retain_previous_owner: retainPreviousOwner,
263261
},
264262
requestMetadata.jwtHeader,
265263
);

0 commit comments

Comments
 (0)