Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit 4a989fd

Browse files
authored
Merge pull request #2 from Multiverse-io/add-github-action-workflow
Add GitHub Action to build and publish SDK to GitHub Packages
2 parents e720d06 + ed75a7b commit 4a989fd

22 files changed

+186
-145
lines changed

.github/workflows/changelog-to-confluence.yml

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

.github/workflows/cla.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Release Github Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
# Note: paths filter intentionally omitted for push events.
10+
# Adding paths would break tag-triggered releases since tag pushes
11+
# don't have file changes to match against.
12+
pull_request:
13+
types:
14+
- opened
15+
- synchronize
16+
paths:
17+
- 'packages/**'
18+
- '.github/workflows/release-package.yml'
19+
workflow_dispatch:
20+
21+
concurrency: ${{ github.workflow }}-${{ github.ref }}
22+
23+
env:
24+
GITHUB_READ_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
jobs:
27+
lint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: '25.3.0'
34+
- run: yarn install --frozen-lockfile
35+
- run: yarn format
36+
- run: yarn lint
37+
38+
test:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: '25.3.0'
45+
- run: yarn install --frozen-lockfile
46+
- run: yarn test:unit
47+
48+
build:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-node@v4
53+
with:
54+
node-version: '25.3.0'
55+
- run: yarn install --frozen-lockfile
56+
- run: yarn build:bundle
57+
58+
publish:
59+
needs:
60+
- lint
61+
- test
62+
- build
63+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
64+
runs-on: ubuntu-latest
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
permissions:
68+
packages: write
69+
contents: write
70+
pull-requests: write
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
# Fetch all history and tags for proper versioning
75+
fetch-depth: 0
76+
77+
- uses: actions/setup-node@v4
78+
with:
79+
node-version: '25.3.0'
80+
registry-url: https://npm.pkg.github.com/
81+
scope: '@multiverse-io'
82+
83+
- run: yarn install --frozen-lockfile
84+
- run: yarn build:bundle
85+
86+
- name: Prepare RUM package for publishing
87+
run: |
88+
cd packages/rum
89+
# Update package name to scoped version
90+
node -e "const pkg=require('./package.json'); pkg.name='@multiverse-io/browser-rum'; pkg.publishConfig={registry:'https://npm.pkg.github.com', access:'public'}; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
91+
92+
- name: Publish to GitHub Packages
93+
run: |
94+
cd packages/rum
95+
# Create .npmrc with auth token
96+
echo "@multiverse-io:registry=https://npm.pkg.github.com" > .npmrc
97+
echo "//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN" >> .npmrc
98+
npm publish --access public
99+
env:
100+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Create Release (on tag)
103+
if: startsWith(github.ref, 'refs/tags/')
104+
uses: softprops/action-gh-release@v1
105+
with:
106+
files: |
107+
packages/rum/bundle/**/*
108+
generate_release_notes: true
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

FORK_README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ The challenge: When multiple applications on the same page try to use the standa
1616
// Ariel's DataDog (standard SDK)
1717
window.DD_RUM.init({
1818
applicationId: 'ariel-app-id',
19-
service: 'ariel'
19+
service: 'ariel',
2020
})
2121

2222
// Atlas tries to use DataDog too
2323
window.DD_RUM.init({
2424
applicationId: 'atlas-app-id',
25-
service: 'atlas'
25+
service: 'atlas',
2626
})
2727
// ❌ This overwrites Ariel's instance!
2828
// ❌ Session tracking gets mixed between the two
@@ -37,13 +37,13 @@ This fork renames all DataDog globals to use the `ATLAS_SDK` prefix, allowing At
3737
// Ariel's DataDog (standard SDK)
3838
window.DD_RUM.init({
3939
applicationId: 'ariel-app-id',
40-
service: 'ariel'
40+
service: 'ariel',
4141
})
4242

4343
// Atlas DataDog (this fork)
4444
window.ATLAS_SDK_DD_RUM.init({
4545
applicationId: 'atlas-app-id',
46-
service: 'atlas'
46+
service: 'atlas',
4747
})
4848
// ✅ Both instances coexist peacefully
4949
// ✅ Separate session tracking
@@ -55,24 +55,26 @@ window.ATLAS_SDK_DD_RUM.init({
5555
All DataDog globals and storage keys have been renamed with the `ATLAS_SDK` prefix:
5656

5757
### Globals
58+
5859
- `window.DD_RUM``window.ATLAS_SDK_DD_RUM`
5960
- `window.DD_LOGS``window.ATLAS_SDK_DD_LOGS`
6061
- `window.DD_RUM_SYNTHETICS``window.ATLAS_SDK_DD_RUM_SYNTHETICS`
6162
- `window.DD_SOURCE_CODE_CONTEXT``window.ATLAS_SDK_DD_SOURCE_CODE_CONTEXT`
6263
- `window.DatadogEventBridge``window.AtlasSDKDatadogEventBridge`
6364

6465
### Storage Keys
66+
6567
- `_dd_s``_atlas_sdk_s` (session cookie)
6668
- `_dd_c``_atlas_sdk_c` (context storage prefix)
6769
- `_dd_test_``_atlas_sdk_test_` (localStorage test)
6870

6971
### Product Keys
72+
7073
- `rum``atlas-sdk-rum`
7174
- `logs``atlas-sdk-logs`
7275

7376
This ensures complete isolation between Atlas's DataDog instance and any other DataDog instances on the same page.
7477

75-
7678
## Known Limitations
7779

7880
As documented in [DataDog/browser-sdk#2994](https://github.com/DataDog/browser-sdk/issues/2994), some features cannot be fully separated between multiple instances:
@@ -90,11 +92,13 @@ You may need to add filtering in your `beforeSend` hooks to prevent cross-pollut
9092
**Must be built with Node.js v22+ (we used v25.3.0)**
9193

9294
Check your Node version:
95+
9396
```bash
9497
node --version # Should be v22.x or higher
9598
```
9699

97100
If you need to switch Node versions:
101+
98102
```bash
99103
nvm use 25.3.0 # or the version specified in package.json
100104
```
@@ -127,7 +131,6 @@ yarn test
127131
git push origin main
128132
```
129133

130-
131134
### Automated Rename (if needed)
132135

133136
The renames follow a consistent pattern. If you need to reapply them after a merge, you can use find/replace:
@@ -138,7 +141,6 @@ The renames follow a consistent pattern. If you need to reapply them after a mer
138141
- `'_dd_c'``'_atlas_sdk_c'`
139142
- etc.
140143

141-
142144
## Links
143145

144146
- **Upstream Repository:** https://github.com/DataDog/browser-sdk

eslint.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export default tseslint.config(
2525
'packages/*/cjs',
2626
'packages/*/esm',
2727
'test/**/dist',
28-
'test/apps/react-heavy-spa',
29-
'test/apps/react-shopist-like',
28+
'test/apps/**', // Exclude all DataDog test apps (have inherited lint errors)
3029
'sandbox',
3130
'coverage',
3231
'rum-events-format',

packages/core/src/boot/displayAlreadyInitializedError.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('displayAlreadyInitializedError', () => {
77
const displayErrorSpy = spyOn(display, 'error')
88
displayAlreadyInitializedError('ATLAS_SDK_DD_RUM', {} as InitConfiguration)
99
expect(displayErrorSpy).toHaveBeenCalledTimes(1)
10-
expect(displayErrorSpy).toHaveBeenCalledWith('DD_RUM is already initialized.')
10+
expect(displayErrorSpy).toHaveBeenCalledWith('ATLAS_SDK_DD_RUM is already initialized.')
1111
})
1212

1313
it('should not display an error if the "silentMultipleInit" option is used', () => {

packages/core/src/boot/displayAlreadyInitializedError.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import type { InitConfiguration } from '../domain/configuration'
22
import { display } from '../tools/display'
33

4-
export function displayAlreadyInitializedError(sdkName: 'ATLAS_SDK_DD_RUM' | 'ATLAS_SDK_DD_LOGS', initConfiguration: InitConfiguration) {
4+
export function displayAlreadyInitializedError(
5+
sdkName: 'ATLAS_SDK_DD_RUM' | 'ATLAS_SDK_DD_LOGS',
6+
initConfiguration: InitConfiguration
7+
) {
58
if (!initConfiguration.silentMultipleInit) {
69
display.error(`${sdkName} is already initialized.`)
710
}

packages/core/src/domain/contexts/accountContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('account context across pages', () => {
8282
accountContext.setContext({ id: '123' })
8383

8484
expect(accountContext.getContext()).toEqual({ id: '123' })
85-
expect(localStorage.getItem('_dd_c_rum_4')).toBeNull()
85+
expect(localStorage.getItem('_atlas_sdk_c_rum_4')).toBeNull()
8686
})
8787

8888
it('when enabled, should maintain the account in local storage', () => {
@@ -94,6 +94,6 @@ describe('account context across pages', () => {
9494

9595
accountContext.setContext({ id: 'foo', qux: 'qix' })
9696
expect(accountContext.getContext()).toEqual({ id: 'foo', qux: 'qix' })
97-
expect(localStorage.getItem('_dd_c_some_product_key_4')).toBe('{"id":"foo","qux":"qix"}')
97+
expect(localStorage.getItem('_atlas_sdk_c_some_product_key_4')).toBe('{"id":"foo","qux":"qix"}')
9898
})
9999
})

packages/core/src/domain/contexts/globalContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('global context across pages', () => {
7070
globalContext.setContext({ id: '123' })
7171

7272
expect(globalContext.getContext()).toEqual({ id: '123' })
73-
expect(localStorage.getItem('_dd_c_some_product_key_2')).toBeNull()
73+
expect(localStorage.getItem('_atlas_sdk_c_some_product_key_2')).toBeNull()
7474
})
7575

7676
it('when enabled, should maintain the global context in local storage', () => {
@@ -83,6 +83,6 @@ describe('global context across pages', () => {
8383

8484
globalContext.setContext({ id: 'foo', qux: 'qix' })
8585
expect(globalContext.getContext()).toEqual({ id: 'foo', qux: 'qix' })
86-
expect(localStorage.getItem('_dd_c_some_product_key_2')).toBe('{"id":"foo","qux":"qix"}')
86+
expect(localStorage.getItem('_atlas_sdk_c_some_product_key_2')).toBe('{"id":"foo","qux":"qix"}')
8787
})
8888
})

packages/core/src/domain/contexts/userContext.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('user context across pages', () => {
138138
userContext.setContext({ id: '123' })
139139

140140
expect(userContext.getContext()).toEqual({ id: '123' })
141-
expect(localStorage.getItem('_dd_c_some_product_key_1')).toBeNull()
141+
expect(localStorage.getItem('_atlas_sdk_c_some_product_key_1')).toBeNull()
142142
})
143143

144144
it('when enabled, should maintain the user in local storage', () => {
@@ -151,6 +151,6 @@ describe('user context across pages', () => {
151151

152152
userContext.setContext({ id: 'foo', qux: 'qix' })
153153
expect(userContext.getContext()).toEqual({ id: 'foo', qux: 'qix' })
154-
expect(localStorage.getItem('_dd_c_some_product_key_1')).toBe('{"id":"foo","qux":"qix"}')
154+
expect(localStorage.getItem('_atlas_sdk_c_some_product_key_1')).toBe('{"id":"foo","qux":"qix"}')
155155
})
156156
})

0 commit comments

Comments
 (0)