-
Notifications
You must be signed in to change notification settings - Fork 16
75 lines (60 loc) · 1.87 KB
/
Copy pathtest-on-release.yml
File metadata and controls
75 lines (60 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Test on Release
on:
push:
branches:
- main
- develop
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- main
- develop
jobs:
test:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Run tests
run: yarn test
deploy:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Wait for npm publish
run: sleep 30 # 延遲30秒,可根據實際情況調整
- name: Enable Corepack
run: corepack enable
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Replace local links with actual versions
working-directory: ./example
run: |
sed -i 's#"@acrool/react-carousel": "link:.."#"@acrool/react-carousel": "latest"#' package.json
sed -i 's#"react": "link:../node_modules/react"#"react": "^19.1.0"#' package.json
sed -i 's#"react-dom": "link:../node_modules/react-dom"#"react-dom": "^19.1.0"#' package.json
- name: Install dependencies
working-directory: ./example
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
run: yarn install
- name: Build Storybook & Deploy to Cloudflare Pages
working-directory: ./example
run: yarn pages:deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}