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