Skip to content

Commit

Permalink
feat: github action with pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqingchen committed Jan 4, 2024
1 parent 193b997 commit 56d2c20
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 277 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/assemble_android_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,14 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
- name: Build Taro React Native Bundle
run: |
yarn build:rn --platform android
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand All @@ -83,6 +67,7 @@ jobs:
bundle exec fastlane assemble
env:
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
- name: Upload Android Products
uses: actions/upload-artifact@v2
with:
Expand Down
26 changes: 7 additions & 19 deletions .github/workflows/assemble_android_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,14 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand All @@ -80,6 +67,7 @@ jobs:
bundle exec fastlane assemble
env:
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
- name: Upload Android Products
uses: actions/upload-artifact@v2
with:
Expand Down
29 changes: 7 additions & 22 deletions .github/workflows/assemble_ios_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,21 @@ jobs:
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Pods
uses: actions/cache@v2
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependencies
run: |
yarn
- name: Build Taro React Native Bundle
run: |
yarn build:rn --platform ios
- name: Install pods
run: cd ios && pod update --no-repo-update
- name: Import signing certificate
Expand All @@ -84,6 +68,7 @@ jobs:
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
run: |
cd ios
bundle update
Expand Down
26 changes: 7 additions & 19 deletions .github/workflows/assemble_ios_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,21 @@ jobs:
run: echo "::set-output name=timestamp::$(TZ=Asia/Shanghai date +'%y%m%d%H%M')"
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Pods
uses: actions/cache@v2
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependencies
run: |
yarn
- name: Install pods
run: cd ios && pod update --no-repo-update
- name: Import signing certificate
Expand All @@ -87,6 +74,7 @@ jobs:
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
run: |
cd ios
bundle update
Expand Down
28 changes: 7 additions & 21 deletions .github/workflows/assemble_weapp_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Import Weapp Key
run: echo "$WEAPP_KEY" | base64 --decode > key/private.appid.key
env:
WEAPP_KEY: ${{ env.WEAPP_KEY }}
- name: Build Taro Playground Weapp
run: |
yarn build:weapp -- --upload
run: pnpm build:weapp -- --upload
env:
WEAPP_ID: ${{ env.WEAPP_ID }}
28 changes: 7 additions & 21 deletions .github/workflows/assemble_web_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Build Taro Playground Web
run: |
yarn build:h5
run: pnpm build:h5
- name: Deploy github pages
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ https://testflight.apple.com/join/RDFCp2yy
> **run this script after the project is initialized.**
```
yarn upgradePeerdeps
pnpm upgradePeerdeps
```

### pod install
Expand All @@ -45,31 +45,31 @@ yarn upgradePeerdeps
> see [pod-install](https://www.npmjs.com/package/pod-install) for more information.
```
yarn podInstall
pnpm podInstall
```

### start ios app

```
yarn ios
pnpm ios
```

### start android app

```
yarn android
pnpm android
```

### start bundler

```
yarn start
pnpm start
```

### reset cache and start bundler

```
yarn start --reset-cache
pnpm start --reset-cache
```

### more information
Expand All @@ -83,13 +83,13 @@ yarn start --reset-cache
### build ios bundle

```
yarn build:rn --platform ios
pnpm build:rn --platform ios
```

### build Android bundle

```
yarn build:rn --platform android
pnpm build:rn --platform android
```

### release ios APP
Expand Down Expand Up @@ -197,7 +197,7 @@ This project supports web and mini program, but it has not been fully tested.
### start web server
```shell
yarn dev:h5
pnpm dev:h5
```

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

```shell
yarn dev:weapp
pnpm dev:weapp
```

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

## Harmony support

### start harmony

```shell
pnpm dev:harmony
```

## Attention

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.
Expand Down
7 changes: 6 additions & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ const config = {
}
}
},
harmony: require('./harmony.json'),
harmony: {
compiler: "vite",
projectPath: process.env.HARMONY_PROJECT_PATH || 'dist',
hapName: "entry",
name: "default"
},
rn: {
appName: 'taroDemo',
output: {
Expand Down
Loading

0 comments on commit 56d2c20

Please sign in to comment.