[CI] Use python3 #129
This file contains 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 | |
- name: Process data | |
run: | | |
cd ./src/data | |
node processData.js | |
env: | |
COMMITID: ${{ steps.commit.outputs.short }} | |
- name: commit | |
uses: EndBug/[email protected] | |
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 | |
run: | | |
corepack enable pnpm | |
pnpm --version | |
- name: Install dependencies | |
run: | | |
pnpm install --frozen-lockfile | |
- name: Build | |
run: | | |
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: '3.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 |