From 2f0ea17b896a19bea66acc26df581f4b5daca00f Mon Sep 17 00:00:00 2001 From: camera-2018 <2907618001@qq.com> Date: Mon, 19 Jun 2023 12:24:38 +0800 Subject: [PATCH] feat: ci --- .github/workflows/cos.yaml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/cos.yaml diff --git a/.github/workflows/cos.yaml b/.github/workflows/cos.yaml new file mode 100644 index 0000000..f79e709 --- /dev/null +++ b/.github/workflows/cos.yaml @@ -0,0 +1,41 @@ +name: update to cos + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@master + + - name: install dependencies + run: | + sudo pip install coscmd + sudo pip install tccli + npm i + + - name: build + run: | + npm run docs:build + + - name: confirgure coscmd and tccli + env: + SECRET_ID: ${{ secrets.TCLOUD_API_ID }} + SECRET_KEY: ${{ secrets.TCLOUD_API_KEY }} + BUCKET: hdu-cs-wiki-1307923872 + 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: upload and refresh cdn + run: | + coscmd upload -rfs --delete ./.vitepress/dist/ / + tccli cdn PurgePathCache --cli-unfold-argument --Paths https://wiki.xyxsw.site/ --FlushType flush \ No newline at end of file