Skip to content

Commit

Permalink
feat: github actions use pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqingchen committed Jan 3, 2024
1 parent 193b997 commit 1c0f8de
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 134 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/assemble_android_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,26 @@ env:
jobs:
assemble:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout Project
uses: actions/checkout@v2
- uses: actions/setup-java@v4
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand Down
30 changes: 11 additions & 19 deletions .github/workflows/assemble_android_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,26 @@ env:
jobs:
assemble:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout Project
uses: actions/checkout@v2
- uses: actions/setup-java@v4
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand Down
33 changes: 11 additions & 22 deletions .github/workflows/assemble_ios_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,29 @@ env:
jobs:
assemble:
runs-on: macos-13
strategy:
matrix:
node-version: [20]
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
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 Down
30 changes: 11 additions & 19 deletions .github/workflows/assemble_ios_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,32 @@ env:
jobs:
assemble:
runs-on: macos-13
strategy:
matrix:
node-version: [20]
steps:
- name: Get current date
id: date
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
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 Down
33 changes: 12 additions & 21 deletions .github/workflows/assemble_weapp_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,26 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
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 }}
33 changes: 12 additions & 21 deletions .github/workflows/assemble_web_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,23 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
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
- name: Use Node.js ${{ matrix.node-version }}
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: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
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

0 comments on commit 1c0f8de

Please sign in to comment.