Skip to content

Commit 93b1511

Browse files
committed
迁移主站至腾讯云COS
Revert 967a001
1 parent 967a001 commit 93b1511

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,34 @@ jobs:
5353
with:
5454
directory: public
5555
add_suffix: false
56-
- name: Deploy to EdgeOne Pages
57-
run: npx edgeone pages deploy ./public -n potat0-box -t ${{secrets.EDGEONE_API_TOKEN}}
56+
- name: Deploy to TencentCloud COS
57+
env:
58+
SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }}
59+
SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
60+
REGION: ap-guangzhou
61+
BUCKET: potat0-box-1307988268
62+
run: |
63+
pip install coscmd
64+
coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
65+
cd public
66+
coscmd upload -rfs --delete ./ /
67+
- name: Prepare URL List for Refresh and Prefetch
68+
run: |
69+
echo "https://www.potat0.cc/" > urls.txt
70+
cd public
71+
find . -type f -not -path '*/.*' -not -path './index.html' -not -path './posts/*' | sed "s|^./|https://www.potat0.cc/|" >> ../urls.txt
72+
find . -type f -not -path '*/.*' -a -path './posts/*' -a \( -name '*.html' -o -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' -o -name '*.bmp' -o -name '*.gif' -o -name '*.svg' -o -name '*.webp' \) | sed "s|^./|https://www.potat0.cc/|" >> ../urls.txt
73+
cd ..
74+
echo "$(wc -l < urls.txt) URLs in total"
75+
- name: Refresh and Prefetch TencentCloud EdgeOne
76+
env:
77+
TENCENTCLOUD_SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }}
78+
TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
79+
TENCENTCLOUD_REGION: ap-guangzhou
80+
run: |
81+
pip install tccli
82+
tccli teo CreatePurgeTask --cli-unfold-argument --ZoneId zone-3d2iwq53tqx6 --Type purge_host --Targets 'www.potat0.cc'
83+
cat urls.txt | xargs -I {} tccli teo CreatePrefetchTask --cli-unfold-argument --ZoneId zone-3d2iwq53tqx6 --Targets {}
5884
5985
build-cn:
6086
name: Build CN

0 commit comments

Comments
 (0)