[CICD] Use up-to-date env in github actions #119
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 | |
- pull_request | |
jobs: | |
processData: | |
runs-on: ubuntu-24.04 | |
name: process data file | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 22.12.0 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 22.12.0 | |
- name: get commit info | |
id: commit | |
uses: pr-mpt/actions-commit-hash@v1 | |
with: | |
prefix: 'commit_' | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: yarn install & process | |
run: | | |
cd ./src/data | |
yarn install | |
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-24.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 22.12.0 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 22.12.0 | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: yarn install & build | |
run: | | |
yarn install | |
yarn build | |
env: | |
CI: false | |
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 |