55 tags :
66 - ' v*' # 当推送带有 v 前缀的标签时触发
77
8+ env :
9+ NODE_VERSION : ' 23.11.1'
10+ BUILD_MODE : release
11+
812jobs :
9- deploy-prod :
13+ preflight :
14+ name : Release preflight
1015 runs-on : ubuntu-latest
1116 steps :
1217 - name : Checkout code
@@ -15,26 +20,70 @@ jobs:
1520 - name : Setup Node.js
1621 uses : actions/setup-node@v4
1722 with :
18- node-version : ' 18 '
23+ node-version : ${{ env.NODE_VERSION }}
1924
2025 - name : Install dependencies
21- run : yarn
26+ run : yarn install --immutable
2227
23- - name : Export BUILD_MODE
24- run : export BUILD_MODE=release
28+ - name : Validate tag matches package version
29+ run : |
30+ FULL_VERSION=$(node -p "require('./lerna.json').version")
31+ TAG_VERSION="${GITHUB_REF_NAME#v}"
32+ if [ "$FULL_VERSION" != "$TAG_VERSION" ]; then
33+ echo "Tag v$TAG_VERSION does not match lerna.json version $FULL_VERSION"
34+ exit 1
35+ fi
2536
26- - name : Get version
37+ - name : Check release metadata
38+ run : node scripts/release/check-release.js
39+
40+ - name : Run release checks
2741 run : |
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
42+ yarn format
43+ yarn build
44+ yarn lint
45+ node scripts/check-packages.js
46+ yarn typecheck
47+ yarn test:unit --single-run
48+ yarn test:compat:tsc
49+ yarn test:compat:ssr
3450
3551 - name : Build bundle
3652 run : yarn build:bundle
3753
54+ - name : Upload bundle artifact
55+ uses : actions/upload-artifact@v4
56+ with :
57+ name : release-bundles
58+ path : packages/*/bundle/**
59+ if-no-files-found : error
60+
61+ deploy-prod :
62+ needs : preflight
63+ runs-on : ubuntu-latest
64+ steps :
65+ - name : Checkout code
66+ uses : actions/checkout@v4
67+
68+ - name : Setup Node.js
69+ uses : actions/setup-node@v4
70+ with :
71+ node-version : ${{ env.NODE_VERSION }}
72+
73+ - name : Install dependencies
74+ run : yarn install --immutable
75+
76+ - name : Download verified bundle artifact
77+ uses : actions/download-artifact@v4
78+ with :
79+ name : release-bundles
80+ path : packages
81+
82+ - name : Get version
83+ run : |
84+ FULL_VERSION=$(node -p "require('./lerna.json').version")
85+ echo "VERSION=$FULL_VERSION" >> $GITHUB_ENV
86+
3887 - name : Deploy to prod
3988 run : node ./scripts/deploy/deploy-oss.js prod v${VERSION}
4089 env :
@@ -54,11 +103,11 @@ jobs:
54103 - name : Setup Node.js
55104 uses : actions/setup-node@v4
56105 with :
57- node-version : ' 18 '
106+ node-version : ${{ env.NODE_VERSION }}
58107 registry-url : ' https://registry.npmjs.org/'
59108
60109 - name : Install dependencies
61- run : yarn
110+ run : yarn install --immutable
62111
63112 - name : Publish to NPM
64113 run : node ./scripts/deploy/publish-npm.js
0 commit comments