@@ -3,13 +3,18 @@ name: Test on Release
3
3
on :
4
4
push :
5
5
branches :
6
- - ' **'
6
+ - main
7
+ - develop
7
8
tags :
8
9
- ' v[0-9]+.[0-9]+.[0-9]+'
10
+ pull_request :
11
+ branches :
12
+ - main
13
+ - develop
9
14
10
15
jobs :
11
16
test :
12
- if : github.ref_type == 'branch '
17
+ if : github.event_name == 'push' || github.event_name == 'pull_request '
13
18
runs-on : ubuntu-latest
14
19
15
20
steps :
@@ -28,35 +33,36 @@ jobs:
28
33
run : yarn test
29
34
30
35
deploy :
31
- if : startsWith(github.ref, 'refs/tags/v')
32
- runs-on : ubuntu-latest
33
-
34
- defaults :
35
- run :
36
- working-directory : ./example
37
-
38
- steps :
39
- - name : Checkout repository
40
- uses : actions/checkout@v3
41
-
42
- - name : Wait for npm publish
43
- run : sleep 30 # 延遲30秒,可根據實際情況調整
44
-
45
- - name : Set up Node.js
46
- uses : actions/setup-node@v3
47
- with :
48
- node-version : ' 20'
49
-
50
- - name : Replace local links with actual versions
51
- run : |
52
- sed -i 's#"@acrool/react-toaster": "link:.."#"@acrool/react-toaster": "latest"#' package.json
53
- sed -i 's#"react": "link:../node_modules/react"#"react": "^19.1.0"#' package.json
54
- sed -i 's#"react-dom": "link:../node_modules/react-dom"#"react-dom": "^19.1.0"#' package.json
55
-
56
- - name : Install dependencies
57
- run : yarn install
58
-
59
- - name : Build Storybook & Deploy to Cloudflare Pages
60
- run : yarn pages:deploy
61
- env :
62
- CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
36
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
37
+ needs : test
38
+ runs-on : ubuntu-latest
39
+
40
+ defaults :
41
+ run :
42
+ working-directory : ./example
43
+
44
+ steps :
45
+ - name : Checkout repository
46
+ uses : actions/checkout@v3
47
+
48
+ - name : Wait for npm publish
49
+ run : sleep 30 # 延遲30秒,可根據實際情況調整
50
+
51
+ - name : Set up Node.js
52
+ uses : actions/setup-node@v3
53
+ with :
54
+ node-version : ' 20'
55
+
56
+ - name : Replace local links with actual versions
57
+ run : |
58
+ sed -i 's#"@acrool/react-toaster": "link:.."#"@acrool/react-toaster": "latest"#' package.json
59
+ sed -i 's#"react": "link:../node_modules/react"#"react": "^19.1.0"#' package.json
60
+ sed -i 's#"react-dom": "link:../node_modules/react-dom"#"react-dom": "^19.1.0"#' package.json
61
+
62
+ - name : Install dependencies
63
+ run : yarn install
64
+
65
+ - name : Build Storybook & Deploy to Cloudflare Pages
66
+ run : yarn pages:deploy
67
+ env :
68
+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
0 commit comments