66 - ' v*' # 当推送带有 v 前缀的标签时触发
77
88jobs :
9- pre-notify :
9+ deploy-prod :
1010 runs-on : ubuntu-latest
1111 steps :
1212 - name : Checkout code
@@ -17,26 +17,35 @@ jobs:
1717 with :
1818 node-version : ' 18'
1919
20- - name : Prepare notification
20+ - name : Install dependencies
21+ run : yarn
22+
23+ - name : Export BUILD_MODE
24+ run : export BUILD_MODE=release
25+
26+ - name : Get version
2127 run : |
22- COMMIT_MESSAGE=$(git show-branch --no-name HEAD)
23- echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
24- echo "BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
25- echo "COMMIT_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }}" >> $GITHUB_ENV
28+ FULL_VERSION=$(node -p -e "require('./lerna.json').version")
29+ MAJOR_VERSION=$(echo $FULL_VERSION | cut -d. -f1)
30+ echo "VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
31+ echo "version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
32+ env :
33+ BUILD_MODE : release
2634
27- - name : Notify deployment ready
28- if : success()
29- uses : slackapi/slack-github-action@v1.25.0
30- with :
31- channel-id : ' rum'
32- payload : |
33- {
34- "text": ":i: ${{ github.repository }} <${{ env.BUILD_URL }}|${{ env.COMMIT_MESSAGE }}> ready to be deployed *automatically* to :flashcatcloud:"
35- }
35+ - name : Build bundle
36+ run : yarn build:bundle
37+
38+ - name : Deploy to prod
39+ run : node ./scripts/deploy/deploy-oss.js prod v${VERSION}
3640 env :
37- SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
41+ OSS_ENDPOINT : ${{ secrets.OSS_ENDPOINT }}
42+ OSS_REGION : ${{ secrets.OSS_REGION }}
43+ OSS_ACCESS_KEY : ${{ secrets.OSS_ACCESS_KEY }}
44+ OSS_BUCKET : ${{ secrets.OSS_BUCKET }}
45+ OSS_SECRET_KEY : ${{ secrets.OSS_SECRET_KEY }}
3846
3947 publish-npm :
48+ needs : deploy-prod
4049 runs-on : ubuntu-latest
4150 steps :
4251 - name : Checkout code
5665 env :
5766 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
5867
59- # publish-developer-extension:
60- # needs: publish-npm
61- # runs-on: ubuntu-latest
62- # steps:
63- # - name: Checkout code
64- # uses: actions/checkout@v4
65-
66- # - name: Setup Node.js
67- # uses: actions/setup-node@v4
68- # with:
69- # node-version: '18'
70-
71- # - name: Install dependencies
72- # run: yarn
73-
74- # - name: Publish developer extension
75- # run: node ./scripts/deploy/publish-developer-extension.js
76- # env:
77- # CHROME_EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }}
78- # CHROME_CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }}
79- # CHROME_CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
80- # CHROME_REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
81-
8268 post-notify-success :
69+ needs : publish-npm
8370 runs-on : ubuntu-latest
8471 if : success()
8572 steps :
@@ -103,18 +90,8 @@ jobs:
10390 env :
10491 SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
10592
106- # - name: Notify ops team
107- # uses: slackapi/slack-github-action@v1.25.0
108- # with:
109- # channel-id: 'rum-browser-sdk-ops'
110- # payload: |
111- # {
112- # "text": ":rocket: ${{ github.repository }} <${{ env.COMMIT_URL }}|${{ env.COMMIT_MESSAGE }}> *automatically* deployed to :earth_americas:."
113- # }
114- # env:
115- # SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
116-
11793 post-notify-failure :
94+ needs : publish-npm
11895 runs-on : ubuntu-latest
11996 if : failure()
12097 steps :
0 commit comments