Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .CHANGELOG.md.swp
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Order is important, the last matching pattern takes the most precedence.

# Global
* @Datadog/rum-browser
* @flashcatcloud/rum-browser

# Docs
*README.md @Datadog/rum-browser @DataDog/documentation
*README.md @flashcatcloud/rum-browser @flashcatcloud/documentation
122 changes: 122 additions & 0 deletions .github/workflows/deploy-auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Automatic Deployment

on:
push:
tags:
- 'v*' # 当推送带有 v 前缀的标签时触发

jobs:
deploy-prod:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: yarn

- name: Export BUILD_MODE
run: export BUILD_MODE=release

- name: Get version
run: |
FULL_VERSION=$(node -p -e "require('./lerna.json').version")
MAJOR_VERSION=$(echo $FULL_VERSION | cut -d. -f1)
echo "VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
echo "version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
env:
BUILD_MODE: release

- name: Build bundle
run: yarn build:bundle

- name: Deploy to prod
run: node ./scripts/deploy/deploy-oss.js prod v${VERSION}
env:
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_REGION: ${{ secrets.OSS_REGION }}
OSS_ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET }}
OSS_SECRET_KEY: ${{ secrets.OSS_SECRET_KEY }}

publish-npm:
needs: deploy-prod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: yarn

- name: Publish to NPM
run: node ./scripts/deploy/publish-npm.js
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

notify-success:
needs: publish-npm
runs-on: ubuntu-latest
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare notification
run: |
COMMIT_MESSAGE=$(git show-branch --no-name HEAD)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "COMMIT_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }}" >> $GITHUB_ENV

- name: Notify deployment success
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_TOKEN }}
secret: ${{ secrets.DING_TALK_SECRET }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "RUM sdk 部署通知",
"text": "### ✅ RUM sdk 部署成功\n\n---\n\n 🔖 分支: ${{ github.ref }}\n\n 📝 提交信息: [${{ github.event.head_commit.message }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n 👨‍💻 提交者: ${{ github.actor }}\n\n 🚀 [查看部署详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
}
}

notify-failure:
needs: publish-npm
runs-on: ubuntu-latest
if: failure()
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare notification
run: |
COMMIT_MESSAGE=$(git show-branch --no-name HEAD)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV

- name: Notify deployment failure
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_TOKEN }}
secret: ${{ secrets.DING_TALK_SECRET }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "RUM sdk 部署通知",
"text": "### ❌ RUM sdk 部署失败 \n\n---\n\n 🔖 分支: ${{ github.ref }}\n\n 📝 提交信息: [${{ github.event.head_commit.message }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n 👨‍💻 提交者: ${{ github.actor }}\n\n 🚀 [查看部署详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
}
}
125 changes: 125 additions & 0 deletions .github/workflows/deploy-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Manual Deployment

on:
workflow_dispatch:
inputs:
confirm_deploy:
description: 'Type "yes" to confirm deployment'
required: true
default: 'no'

jobs:
deploy-prod:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: yarn

- name: Export BUILD_MODE
run: export BUILD_MODE=release

- name: Get version
run: |
FULL_VERSION=$(node -p -e "require('./lerna.json').version")
MAJOR_VERSION=$(echo $FULL_VERSION | cut -d. -f1)
echo "VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
echo "version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
env:
BUILD_MODE: release

- name: Build bundle
run: yarn build:bundle

- name: Deploy to prod
run: node ./scripts/deploy/deploy-oss.js prod v${VERSION}
env:
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_REGION: ${{ secrets.OSS_REGION }}
OSS_ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET }}
OSS_SECRET_KEY: ${{ secrets.OSS_SECRET_KEY }}

publish-npm:
needs: deploy-prod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: yarn

- name: Publish to NPM
run: node ./scripts/deploy/publish-npm.js
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

notify-success:
needs: publish-npm
runs-on: ubuntu-latest
if: success()
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare notification
run: |
COMMIT_MESSAGE=$(git show-branch --no-name HEAD)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "COMMIT_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }}" >> $GITHUB_ENV

- name: Notify deployment success
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_TOKEN }}
secret: ${{ secrets.DING_TALK_SECRET }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "RUM sdk 部署通知",
"text": "### ✅ RUM sdk 部署成功\n\n---\n\n 🔖 分支: ${{ github.ref }}\n\n 📝 提交信息: [${{ github.event.head_commit.message }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n 👨‍💻 提交者: ${{ github.actor }}\n\n 🚀 [查看部署详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
}
}

notify-failure:
needs: publish-npm
runs-on: ubuntu-latest
if: failure()
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare notification
run: |
COMMIT_MESSAGE=$(git show-branch --no-name HEAD)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV

- name: Notify deployment failure
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_TOKEN }}
secret: ${{ secrets.DING_TALK_SECRET }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title": "RUM sdk 部署通知",
"text": "### ❌ RUM sdk 部署失败 \n\n---\n\n 🔖 分支: ${{ github.ref }}\n\n 📝 提交信息: [${{ github.event.head_commit.message }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n 👨‍💻 提交者: ${{ github.actor }}\n\n 🚀 [查看部署详情](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ browserstack.err
/playwright-report/
/blob-report/
/playwright/.cache/
.VSCodeCounter
.env
Loading