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: Continuous integration of static websites to COS | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build_and_deploy: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "21" # 使用 Node.js 21 版本 | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Prepare Yarn | |
run: corepack prepare [email protected] --activate | |
- name: Install dependencies | |
run: yarn install | |
- name: Build with Nuxt | |
run: yarn build | |
- name: Generate | |
run: yarn generate | |
- name: 安装腾讯云依赖 | |
run: | | |
sudo pip install coscmd | |
sudo pip install tccli | |
- name: 配置腾讯云依赖 | |
env: | |
SECRET_ID: ${{ secrets.TCLOUD_API_ID }} | |
SECRET_KEY: ${{ secrets.TCLOUD_API_KEY }} | |
BUCKET: schem-1318358151 | |
REGION: ap-shanghai | |
run: | | |
coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION | |
tccli configure set secretId $SECRET_ID | |
tccli configure set secretKey $SECRET_KEY | |
tccli configure set region $REGION | |
- name: 上传到腾讯云COS并刷新CDN | |
run: | | |
coscmd upload -rfs --delete ./.output/public/ / | |
tccli cdn PurgePathCache --cli-unfold-argument --Paths https://schem.alsace.team/ --FlushType flush |