Skip to content

Commit 83eebb4

Browse files
authored
fix(ci): cdn refresh (#2704) (#2706)
1 parent 382fbdd commit 83eebb4

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

.github/workflows/media.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths:
88
- media/**
99
jobs:
10-
run:
10+
upload:
1111
name: Upload media files
1212
runs-on: ubuntu-latest
1313
steps:
@@ -35,3 +35,41 @@ jobs:
3535
- name: Upload
3636
run: |
3737
cloud-assets-utils verify-and-sync -qiniu true -qiniu-bucket ${{ secrets.QINIU_BUCKET_NAME }} media -replace-first-path-to images/tidb-in-kubernetes -cdn-refresh https://download.pingcap.com/
38+
39+
- name: Install coscli
40+
run: |
41+
wget https://cosbrowser.cloud.tencent.com/software/coscli/coscli-linux-amd64
42+
mv coscli-linux-amd64 coscli
43+
chmod 755 coscli
44+
- name: Upload to COS
45+
run: |
46+
./coscli sync media/ cos://${{ secrets.TENCENTCLOUD_BUCKET_ID }}/media/images/tidb-in-kubernetes \
47+
--init-skip \
48+
--recursive \
49+
--routines 16 \
50+
--secret-id ${{ secrets.TENCENTCLOUD_SECRET_ID }} \
51+
--secret-key ${{ secrets.TENCENTCLOUD_SECRET_KEY }} \
52+
--endpoint cos.ap-beijing.myqcloud.com
53+
54+
cdn-refresh:
55+
needs: upload
56+
runs-on: ubuntu-latest
57+
name: Refresh CDN Cache
58+
env:
59+
TENCENTCLOUD_SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }}
60+
TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Python environment
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.12'
69+
architecture: 'x64'
70+
71+
- name: Install Tencent Cloud CLI
72+
run: pipx install tccli
73+
74+
- name: Purge production CDN cache
75+
run: tccli cdn PurgePathCache --Paths '["https://docs-download.pingcap.com/media/images/tidb-in-kubernetes/"]' --FlushType delete

0 commit comments

Comments
 (0)