11name : Release 3x Beta
22
33on :
4- # pull_request:
5- push :
4+ pull_request :
5+ # push:
66 branches :
77 - feat_v3.x
8+ workflow_dispatch :
89
910jobs :
1011 release-3.x-beta :
1112 env :
1213 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
1314 NPM_CONFIG_PROVENANCE : true
15+ RELEASE_TAG : beta
1416
1517 runs-on : ubuntu-latest
1618 steps :
1719 - uses : actions/checkout@v4
1820 with :
1921 fetch-depth : 0
20- # ref: ${{ github.event.pull_request.head.sha }}
22+ ref : ${{ github.event.pull_request.head.sha }}
2123
2224 - name : Get commit message
2325 run : |
2426 COMMIT_MESSAGE=$(git log --format=%s -n 1)
25- echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
27+ FILTERED_MESSAGE="${COMMIT_MESSAGE//[^a-zA-Z0-9.()_:, -]/}"
28+ echo "COMMIT_MESSAGE=${FILTERED_MESSAGE}" >> $GITHUB_ENV
2629 - name : Show commit message
2730 run : echo "$COMMIT_MESSAGE"
2831
2932 - name : Commit message compliance verification
30- if : startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) != true && contains( env.COMMIT_MESSAGE , '-beta' ) != true
33+ if : |
34+ !startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) ||
35+ !contains( env.COMMIT_MESSAGE , '-beta' )
3136 run : echo "ABORT=true" >> $GITHUB_ENV
3237
3338 - name : Get Tag message
@@ -48,12 +53,30 @@ jobs:
4853
4954 - name : Run Build
5055 if : env.ABORT != 'true'
51- run : pnpm build && pnpm build:taro
56+ run : |
57+ if ! pnpm build; then
58+ echo "构建 nutui-react 失败"
59+ exit 1
60+ fi
61+ if ! pnpm build:taro; then
62+ echo "构建 nutui-react-taro 失败"
63+ exit 1
64+ fi
5265
5366 - name : Run Release @nutui/nutui-react
5467 if : env.ABORT != 'true'
55- run : cd ./release/h5 && npm publish --dry-run --tag beta
68+ run : |
69+ cd ./release/h5 || exit 1
70+ if ! npm publish --dry-run --tag ${{ env.RELEASE_TAG }}; then
71+ echo "发布 @nutui/nutui-react 失败"
72+ exit 1
73+ fi
5674
5775 - name : Run Releases @nutui/nutui-react-taro
5876 if : env.ABORT != 'true'
59- run : cd ./release/taro && npm publish --dry-run --tag beta
77+ run : |
78+ cd ./release/taro || exit 1
79+ if ! npm publish --dry-run --tag ${{ env.RELEASE_TAG }}; then
80+ echo "发布 @nutui/nutui-react-taro 失败"
81+ exit 1
82+ fi
0 commit comments