Skip to content

Commit 56d2c20

Browse files
committed
feat: github action with pnpm
1 parent 193b997 commit 56d2c20

File tree

11 files changed

+214
-277
lines changed

11 files changed

+214
-277
lines changed

.github/workflows/assemble_android_debug.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,14 @@ jobs:
4242
with:
4343
distribution: 'zulu'
4444
java-version: '17'
45-
- name: Cache node_modules Folder
46-
uses: actions/cache@v2
45+
- uses: pnpm/action-setup@v2
4746
with:
48-
path: ${{ github.workspace }}/node_modules
49-
key: ${{ runner.os }}-node_modules
50-
restore-keys: ${{ runner.os }}-node_modules
51-
- name: Get Yarn Cache Directory Path
52-
id: yarn-cache-dir-path
53-
run: echo "::set-output name=dir::$(yarn cache dir)"
54-
- name: Cache Yarn
55-
uses: actions/cache@v2
56-
env:
57-
cache-name: yarn-cache
47+
version: 8
48+
- uses: actions/setup-node@v3
5849
with:
59-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
60-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
61-
restore-keys: |
62-
${{ runner.os }}-yarn-
63-
- name: Install Dependencies
64-
run: |
65-
yarn
66-
- name: Build Taro React Native Bundle
67-
run: |
68-
yarn build:rn --platform android
50+
node-version: 20
51+
cache: 'pnpm'
52+
- run: pnpm install
6953
- name: Cache Gradle
7054
uses: actions/cache@v2
7155
env:
@@ -83,6 +67,7 @@ jobs:
8367
bundle exec fastlane assemble
8468
env:
8569
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
70+
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
8671
- name: Upload Android Products
8772
uses: actions/upload-artifact@v2
8873
with:

.github/workflows/assemble_android_release.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,14 @@ jobs:
4242
with:
4343
distribution: 'zulu'
4444
java-version: '17'
45-
- name: Cache node_modules Folder
46-
uses: actions/cache@v2
45+
- uses: pnpm/action-setup@v2
4746
with:
48-
path: ${{ github.workspace }}/node_modules
49-
key: ${{ runner.os }}-node_modules
50-
restore-keys: ${{ runner.os }}-node_modules
51-
- name: Get Yarn Cache Directory Path
52-
id: yarn-cache-dir-path
53-
run: echo "::set-output name=dir::$(yarn cache dir)"
54-
- name: Cache Yarn
55-
uses: actions/cache@v2
56-
env:
57-
cache-name: yarn-cache
47+
version: 8
48+
- uses: actions/setup-node@v3
5849
with:
59-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
60-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
61-
restore-keys: |
62-
${{ runner.os }}-yarn-
63-
- name: Install Dependencies
64-
run: |
65-
yarn
50+
node-version: 20
51+
cache: 'pnpm'
52+
- run: pnpm install
6653
- name: Cache Gradle
6754
uses: actions/cache@v2
6855
env:
@@ -80,6 +67,7 @@ jobs:
8067
bundle exec fastlane assemble
8168
env:
8269
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
70+
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
8371
- name: Upload Android Products
8472
uses: actions/upload-artifact@v2
8573
with:

.github/workflows/assemble_ios_debug.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,21 @@ jobs:
3030
steps:
3131
- name: Checkout Project
3232
uses: actions/checkout@v2
33-
- name: Cache node_modules Folder
34-
uses: actions/cache@v2
33+
- uses: pnpm/action-setup@v2
3534
with:
36-
path: ${{ github.workspace }}/node_modules
37-
key: ${{ runner.os }}-node_modules
38-
restore-keys: ${{ runner.os }}-node_modules
39-
- name: Get Yarn Cache Directory Path
40-
id: yarn-cache-dir-path
41-
run: echo "::set-output name=dir::$(yarn cache dir)"
42-
- name: Cache Yarn
43-
uses: actions/cache@v2
44-
env:
45-
cache-name: yarn-cache
35+
version: 8
36+
- uses: actions/setup-node@v3
4637
with:
47-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
48-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
49-
restore-keys: |
50-
${{ runner.os }}-yarn-
38+
node-version: 20
39+
cache: 'pnpm'
40+
- run: pnpm install
5141
- name: Cache Pods
5242
uses: actions/cache@v2
5343
with:
5444
path: ios/Pods
5545
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
5646
restore-keys: |
5747
${{ runner.os }}-pods-
58-
- name: Install Dependencies
59-
run: |
60-
yarn
61-
- name: Build Taro React Native Bundle
62-
run: |
63-
yarn build:rn --platform ios
6448
- name: Install pods
6549
run: cd ios && pod update --no-repo-update
6650
- name: Import signing certificate
@@ -84,6 +68,7 @@ jobs:
8468
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
8569
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
8670
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
71+
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
8772
run: |
8873
cd ios
8974
bundle update

.github/workflows/assemble_ios_release.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,21 @@ jobs:
3636
run: echo "::set-output name=timestamp::$(TZ=Asia/Shanghai date +'%y%m%d%H%M')"
3737
- name: Checkout Project
3838
uses: actions/checkout@v2
39-
- name: Cache node_modules Folder
40-
uses: actions/cache@v2
39+
- uses: pnpm/action-setup@v2
4140
with:
42-
path: ${{ github.workspace }}/node_modules
43-
key: ${{ runner.os }}-node_modules
44-
restore-keys: ${{ runner.os }}-node_modules
45-
- name: Get Yarn Cache Directory Path
46-
id: yarn-cache-dir-path
47-
run: echo "::set-output name=dir::$(yarn cache dir)"
48-
- name: Cache Yarn
49-
uses: actions/cache@v2
50-
env:
51-
cache-name: yarn-cache
41+
version: 8
42+
- uses: actions/setup-node@v3
5243
with:
53-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
54-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
55-
restore-keys: |
56-
${{ runner.os }}-yarn-
44+
node-version: 20
45+
cache: 'pnpm'
46+
- run: pnpm install
5747
- name: Cache Pods
5848
uses: actions/cache@v2
5949
with:
6050
path: ios/Pods
6151
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
6252
restore-keys: |
6353
${{ runner.os }}-pods-
64-
- name: Install Dependencies
65-
run: |
66-
yarn
6754
- name: Install pods
6855
run: cd ios && pod update --no-repo-update
6956
- name: Import signing certificate
@@ -87,6 +74,7 @@ jobs:
8774
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
8875
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
8976
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
77+
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
9078
run: |
9179
cd ios
9280
bundle update

.github/workflows/assemble_weapp_release.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,19 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v3
25-
- name: Cache node_modules Folder
26-
uses: actions/cache@v2
25+
- uses: pnpm/action-setup@v2
2726
with:
28-
path: ${{ github.workspace }}/node_modules
29-
key: ${{ runner.os }}-node_modules
30-
restore-keys: ${{ runner.os }}-node_modules
31-
- name: Get Yarn Cache Directory Path
32-
id: yarn-cache-dir-path
33-
run: echo "::set-output name=dir::$(yarn cache dir)"
34-
- name: Cache Yarn
35-
uses: actions/cache@v2
36-
env:
37-
cache-name: yarn-cache
27+
version: 8
28+
- uses: actions/setup-node@v3
3829
with:
39-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
40-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
41-
restore-keys: |
42-
${{ runner.os }}-yarn-
43-
- name: Install Dependencies
44-
run: |
45-
yarn
30+
node-version: 20
31+
cache: 'pnpm'
32+
- run: pnpm install
4633
- name: Import Weapp Key
4734
run: echo "$WEAPP_KEY" | base64 --decode > key/private.appid.key
4835
env:
4936
WEAPP_KEY: ${{ env.WEAPP_KEY }}
5037
- name: Build Taro Playground Weapp
51-
run: |
52-
yarn build:weapp -- --upload
38+
run: pnpm build:weapp -- --upload
5339
env:
5440
WEAPP_ID: ${{ env.WEAPP_ID }}

.github/workflows/assemble_web_release.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,16 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v3
18-
- name: Cache node_modules Folder
19-
uses: actions/cache@v2
18+
- uses: pnpm/action-setup@v2
2019
with:
21-
path: ${{ github.workspace }}/node_modules
22-
key: ${{ runner.os }}-node_modules
23-
restore-keys: ${{ runner.os }}-node_modules
24-
- name: Get Yarn Cache Directory Path
25-
id: yarn-cache-dir-path
26-
run: echo "::set-output name=dir::$(yarn cache dir)"
27-
- name: Cache Yarn
28-
uses: actions/cache@v2
29-
env:
30-
cache-name: yarn-cache
20+
version: 8
21+
- uses: actions/setup-node@v3
3122
with:
32-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
33-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
34-
restore-keys: |
35-
${{ runner.os }}-yarn-
36-
- name: Install Dependencies
37-
run: |
38-
yarn
23+
node-version: 20
24+
cache: 'pnpm'
25+
- run: pnpm install
3926
- name: Build Taro Playground Web
40-
run: |
41-
yarn build:h5
27+
run: pnpm build:h5
4228
- name: Deploy github pages
4329
uses: peaceiris/actions-gh-pages@v3
4430
with:

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ https://testflight.apple.com/join/RDFCp2yy
3636
> **run this script after the project is initialized.**
3737
3838
```
39-
yarn upgradePeerdeps
39+
pnpm upgradePeerdeps
4040
```
4141

4242
### pod install
@@ -45,31 +45,31 @@ yarn upgradePeerdeps
4545
> see [pod-install](https://www.npmjs.com/package/pod-install) for more information.
4646
4747
```
48-
yarn podInstall
48+
pnpm podInstall
4949
```
5050

5151
### start ios app
5252

5353
```
54-
yarn ios
54+
pnpm ios
5555
```
5656

5757
### start android app
5858

5959
```
60-
yarn android
60+
pnpm android
6161
```
6262

6363
### start bundler
6464

6565
```
66-
yarn start
66+
pnpm start
6767
```
6868

6969
### reset cache and start bundler
7070

7171
```
72-
yarn start --reset-cache
72+
pnpm start --reset-cache
7373
```
7474

7575
### more information
@@ -83,13 +83,13 @@ yarn start --reset-cache
8383
### build ios bundle
8484

8585
```
86-
yarn build:rn --platform ios
86+
pnpm build:rn --platform ios
8787
```
8888

8989
### build Android bundle
9090

9191
```
92-
yarn build:rn --platform android
92+
pnpm build:rn --platform android
9393
```
9494

9595
### release ios APP
@@ -197,7 +197,7 @@ This project supports web and mini program, but it has not been fully tested.
197197
### start web server
198198
199199
```shell
200-
yarn dev:h5
200+
pnpm dev:h5
201201
```
202202

203203
### Github workflows of Web
@@ -207,7 +207,7 @@ see [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages)
207207
### start wechat mini program
208208

209209
```shell
210-
yarn dev:weapp
210+
pnpm dev:weapp
211211
```
212212

213213
### Github workflows of Wechat Mini Program
@@ -232,6 +232,14 @@ values like ${{secrets.xxxxx}} are manually generated and store in your github e
232232
cat private.$WEAPP_ID.key | base64 | pbcopy
233233
```
234234

235+
## Harmony support
236+
237+
### start harmony
238+
239+
```shell
240+
pnpm dev:harmony
241+
```
242+
235243
## Attention
236244

237245
The source code is customized for the Taro playground application and is for reference only. If you want to use it directly, please make the following changes.

config/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ const config = {
9292
}
9393
}
9494
},
95-
harmony: require('./harmony.json'),
95+
harmony: {
96+
compiler: "vite",
97+
projectPath: process.env.HARMONY_PROJECT_PATH || 'dist',
98+
hapName: "entry",
99+
name: "default"
100+
},
96101
rn: {
97102
appName: 'taroDemo',
98103
output: {

0 commit comments

Comments
 (0)