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: auto-build and upload to tencent COS | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v1 | |
- name: Setup Node | |
uses: actions/setup-node@master | |
- name: Install & Build | |
run: | | |
npm install | |
npm run build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
- name: Sync-to-tencent-cos | |
run: | | |
pip install coscmd | |
echo "Sync to tencent cos..." | |
cd dist | |
coscmd config -a ${{ secrets.SECRET_ID }} -s ${{ secrets.SECRET_KEY }} -b ${{ secrets.BUCKET }} -e cos.accelerate.myqcloud.com -m 30 | |
coscmd upload -rs ./ / --ignore "./.git/*","./.github/*","./README.md" | |
coscmd abort | |
echo "Delete old files..." | |
curl https://raw.githubusercontent.com/ljxi/Sync-to-tencent-cos/main/Delete-old-files.py -o ./Delete-old-files.py | |
python Delete-old-files.py | |
echo "Sync to tencent cos done!" |