[Chown] Use pnpm to fix CI #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: update website | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| processData: | |
| runs-on: ubuntu-latest | |
| name: process data file | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22.x' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: latest | |
| - name: get commit info | |
| id: commit | |
| uses: pr-mpt/actions-commit-hash@v3 | |
| with: | |
| prefix: 'commit_' | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| cd ./src/data | |
| pnpm install | |
| node processData.js | |
| env: | |
| COMMITID: ${{ steps.commit.outputs.short }} | |
| - name: commit | |
| uses: EndBug/add-and-commit@v9.0.0 | |
| with: | |
| message: "[Bot] Auto process data files" | |
| committer_name: "Github Actions Bot - processData" | |
| committer_email: "<>" | |
| add: . | |
| deploy: | |
| name: deploy to Tencent COS | |
| needs: processData | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22.x' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: latest | |
| - name: Install dependencies & build | |
| run: | | |
| pnpm install --frozen-lockfile | |
| env | |
| pnpm build | |
| env: | |
| CI: true | |
| NODE_ENV: production | |
| GENERATE_SOURCEMAP: false | |
| - name: Upload COS | |
| uses: TencentCloud/cos-action@v1 | |
| with: | |
| secret_id: ${{ secrets.SECRET_ID }} | |
| secret_key: ${{ secrets.SECRET_KEY }} | |
| cos_bucket: ${{ secrets.BUCKET }} | |
| cos_region: ap-guangzhou | |
| local_path: build | |
| clean: true | |
| - name: Install Python2 | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: '2.x' | |
| architecture: 'x64' | |
| - name: refresh CDN | |
| run: | | |
| pip install tccli | |
| tccli cdn PurgeUrlsCache --Area mainland --cli-unfold-argument --Urls https://mir.ug0.ltd | |
| env: | |
| TENCENTCLOUD_SECRET_ID: ${{ secrets.SECRET_ID }} | |
| TENCENTCLOUD_SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
| TENCENTCLOUD_REGION: ap-guangzhou |