Skip to content

Commit c340f81

Browse files
authored
ci: migrate PDF from Qiniu to Tencent (#19571)
1 parent 3fbb32f commit c340f81

File tree

3 files changed

+83
-70
lines changed

3 files changed

+83
-70
lines changed

.github/workflows/flush-version.yaml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,46 @@ jobs:
2424
flush-pdf:
2525
name: Flush PDF by Version
2626
runs-on: ubuntu-latest
27+
env:
28+
TENCENTCLOUD_SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }}
29+
TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
30+
CDN_BASE_URL: "https://docs-download.pingcap.com/pdf"
2731
steps:
28-
- name: install qiniu qshell
29-
uses: foxundermoon/setup-qshell@v5
32+
- name: Set up Python environment
33+
uses: actions/setup-python@v5
3034
with:
31-
version: '2.6.2'
35+
python-version: '3.12'
36+
architecture: 'x64'
3237

33-
- name: print pdf to a file (tidb)
38+
- name: Install Tencent Cloud CLI
39+
run: pip3 install tccli
40+
41+
- name: Print PDF to a file (tidb)
3442
if: ${{ inputs.type == 'tidb' }}
3543
run: |
36-
echo "https://download.pingcap.org/tidb-${{inputs.version}}-en-manual.pdf" >> pdf.txt
37-
echo "https://download.pingcap.org/tidb-${{inputs.version}}-zh-manual.pdf" >> pdf.txt
38-
cat pdf.txt
44+
echo "${CDN_BASE_URL}/tidb-${{inputs.version}}-en-manual.pdf" >> links.txt
45+
echo "${CDN_BASE_URL}/tidb-${{inputs.version}}-zh-manual.pdf" >> links.txt
46+
cat links.txt
3947
40-
- name: print pdf to a file (tidb cloud)
48+
- name: Print PDF to a file (tidb cloud)
4149
if: ${{ inputs.type == 'tidb cloud' }}
4250
run: |
43-
echo "https://download.pingcap.org/tidbcloud-en-manual.pdf" > pdf.txt
44-
cat pdf.txt
51+
echo "${CDN_BASE_URL}/tidbcloud-en-manual.pdf" > links.txt
52+
cat links.txt
4553
46-
- name: print pdf to a file (tidb operator)
54+
- name: Print PDF to a file (tidb operator)
4755
if: ${{ inputs.type == 'tidb operator' }}
4856
run: |
49-
echo "https://download.pingcap.org/tidb-in-kubernetes-${{inputs.version}}-en-manual.pdf" >> pdf.txt
50-
echo "https://download.pingcap.org/tidb-in-kubernetes-${{inputs.version}}-zh-manual.pdf" >> pdf.txt
51-
cat pdf.txt
57+
echo "${CDN_BASE_URL}/tidb-in-kubernetes-${{inputs.version}}-en-manual.pdf" >> links.txt
58+
echo "${CDN_BASE_URL}/tidb-in-kubernetes-${{inputs.version}}-zh-manual.pdf" >> links.txt
59+
cat links.txt
5260
53-
- name: refresh url
61+
- name: Refresh URLs
5462
run: |
55-
qshell account ${{ secrets.QINIU_ACCESS_KEY }} ${{ secrets.QINIU_SECRET_KEY }} tidb
56-
result=$(qshell cdnrefresh -i pdf.txt)
57-
if echo $result | grep -w '200'; then
58-
echo 'CDN refresh success'
59-
else
60-
echo "CDN refresh failed: $result"
63+
cat links.txt | jq -nR '[inputs | select(length>0)]' | tee links.json
64+
tccli cdn PurgeUrlsCache --Urls "$(cat links.json)" | tee result.json
65+
task_id="$(cat result.json | jq .TaskId)"
66+
if [ -z "${task_id}" ]; then
67+
echo "Unable to find TaskId, CDN refresh might fail"
6168
exit 1
6269
fi

.github/workflows/flush.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,30 @@ jobs:
99
flush-pdf:
1010
name: Flush PDF
1111
runs-on: ubuntu-latest
12+
env:
13+
TENCENTCLOUD_SECRET_ID: ${{ secrets.TENCENTCLOUD_SECRET_ID }}
14+
TENCENTCLOUD_SECRET_KEY: ${{ secrets.TENCENTCLOUD_SECRET_KEY }}
1215
steps:
13-
- name: install qiniu qshell
14-
uses: foxundermoon/setup-qshell@v5
16+
- name: Set up Python environment
17+
uses: actions/setup-python@v5
1518
with:
16-
version: '2.6.2'
19+
python-version: '3.12'
20+
architecture: 'x64'
21+
22+
- name: Install Tencent Cloud CLI
23+
run: pip3 install tccli
1724

1825
- name: Download PDF list
1926
run: |
2027
curl https://raw.githubusercontent.com/pingcap/docs-cn/master/resources/cdnfresh.txt --output cdnfresh.txt
2128
cat cdnfresh.txt
2229
23-
- name: refresh url
30+
- name: Refresh URLs
2431
run: |
25-
qshell account ${{ secrets.QINIU_ACCESS_KEY }} ${{ secrets.QINIU_SECRET_KEY }} tidb
26-
result=$(qshell cdnrefresh -i cdnfresh.txt)
27-
if echo $result | grep -w '200'; then
28-
echo 'CDN refresh success'
29-
else
30-
echo "CDN refresh failed: $result"
32+
cat cdnfresh.txt | jq -nR '[inputs | select(length>0)]' | tee cdnfresh.json
33+
tccli cdn PurgeUrlsCache --Urls "$(cat cdnfresh.json)" | tee result.json
34+
task_id="$(cat result.json | jq .TaskId)"
35+
if [ -z "${task_id}" ]; then
36+
echo "Unable to find TaskId, CDN refresh might fail"
3137
exit 1
3238
fi

resources/cdnfresh.txt

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
https://download.pingcap.org/tidb-dev-zh-manual.pdf
2-
https://download.pingcap.org/tidb-dev-en-manual.pdf
3-
https://download.pingcap.org/tidb-stable-zh-manual.pdf
4-
https://download.pingcap.org/tidb-stable-en-manual.pdf
5-
https://download.pingcap.org/tidb-v8.4-zh-manual.pdf
6-
https://download.pingcap.org/tidb-v8.4-en-manual.pdf
7-
https://download.pingcap.org/tidb-v8.3-zh-manual.pdf
8-
https://download.pingcap.org/tidb-v8.3-en-manual.pdf
9-
https://download.pingcap.org/tidb-v8.1-zh-manual.pdf
10-
https://download.pingcap.org/tidb-v8.1-en-manual.pdf
11-
https://download.pingcap.org/tidb-v8.0-zh-manual.pdf
12-
https://download.pingcap.org/tidb-v8.0-en-manual.pdf
13-
https://download.pingcap.org/tidb-v7.6-zh-manual.pdf
14-
https://download.pingcap.org/tidb-v7.6-en-manual.pdf
15-
https://download.pingcap.org/tidb-v7.5-zh-manual.pdf
16-
https://download.pingcap.org/tidb-v7.5-en-manual.pdf
17-
https://download.pingcap.org/tidb-v7.1-zh-manual.pdf
18-
https://download.pingcap.org/tidb-v7.1-en-manual.pdf
19-
https://download.pingcap.org/tidb-v6.5-zh-manual.pdf
20-
https://download.pingcap.org/tidb-v6.5-en-manual.pdf
21-
https://download.pingcap.org/tidb-v6.1-zh-manual.pdf
22-
https://download.pingcap.org/tidb-v6.1-en-manual.pdf
23-
https://download.pingcap.org/tidb-v5.4-zh-manual.pdf
24-
https://download.pingcap.org/tidb-v5.4-en-manual.pdf
25-
https://download.pingcap.org/tidb-v5.2-zh-manual.pdf
26-
https://download.pingcap.org/tidb-v5.2-en-manual.pdf
27-
https://download.pingcap.org/tidb-v5.1-zh-manual.pdf
28-
https://download.pingcap.org/tidb-v5.1-en-manual.pdf
29-
https://download.pingcap.org/tidb-in-kubernetes-dev-zh-manual.pdf
30-
https://download.pingcap.org/tidb-in-kubernetes-dev-en-manual.pdf
31-
https://download.pingcap.org/tidb-in-kubernetes-stable-zh-manual.pdf
32-
https://download.pingcap.org/tidb-in-kubernetes-stable-en-manual.pdf
33-
https://download.pingcap.org/tidb-in-kubernetes-v1.5-zh-manual.pdf
34-
https://download.pingcap.org/tidb-in-kubernetes-v1.5-en-manual.pdf
35-
https://download.pingcap.org/tidb-in-kubernetes-v1.4-zh-manual.pdf
36-
https://download.pingcap.org/tidb-in-kubernetes-v1.4-en-manual.pdf
37-
https://download.pingcap.org/tidb-in-kubernetes-v1.3-zh-manual.pdf
38-
https://download.pingcap.org/tidb-in-kubernetes-v1.3-en-manual.pdf
39-
https://download.pingcap.org/tidbcloud-en-manual.pdf
1+
https://docs-download.pingcap.com/pdf/tidb-dev-zh-manual.pdf
2+
https://docs-download.pingcap.com/pdf/tidb-dev-en-manual.pdf
3+
https://docs-download.pingcap.com/pdf/tidb-stable-zh-manual.pdf
4+
https://docs-download.pingcap.com/pdf/tidb-stable-en-manual.pdf
5+
https://docs-download.pingcap.com/pdf/tidb-v8.4-zh-manual.pdf
6+
https://docs-download.pingcap.com/pdf/tidb-v8.4-en-manual.pdf
7+
https://docs-download.pingcap.com/pdf/tidb-v8.3-zh-manual.pdf
8+
https://docs-download.pingcap.com/pdf/tidb-v8.3-en-manual.pdf
9+
https://docs-download.pingcap.com/pdf/tidb-v8.1-zh-manual.pdf
10+
https://docs-download.pingcap.com/pdf/tidb-v8.1-en-manual.pdf
11+
https://docs-download.pingcap.com/pdf/tidb-v8.0-zh-manual.pdf
12+
https://docs-download.pingcap.com/pdf/tidb-v8.0-en-manual.pdf
13+
https://docs-download.pingcap.com/pdf/tidb-v7.6-zh-manual.pdf
14+
https://docs-download.pingcap.com/pdf/tidb-v7.6-en-manual.pdf
15+
https://docs-download.pingcap.com/pdf/tidb-v7.5-zh-manual.pdf
16+
https://docs-download.pingcap.com/pdf/tidb-v7.5-en-manual.pdf
17+
https://docs-download.pingcap.com/pdf/tidb-v7.1-zh-manual.pdf
18+
https://docs-download.pingcap.com/pdf/tidb-v7.1-en-manual.pdf
19+
https://docs-download.pingcap.com/pdf/tidb-v6.5-zh-manual.pdf
20+
https://docs-download.pingcap.com/pdf/tidb-v6.5-en-manual.pdf
21+
https://docs-download.pingcap.com/pdf/tidb-v6.1-zh-manual.pdf
22+
https://docs-download.pingcap.com/pdf/tidb-v6.1-en-manual.pdf
23+
https://docs-download.pingcap.com/pdf/tidb-v5.4-zh-manual.pdf
24+
https://docs-download.pingcap.com/pdf/tidb-v5.4-en-manual.pdf
25+
https://docs-download.pingcap.com/pdf/tidb-v5.2-zh-manual.pdf
26+
https://docs-download.pingcap.com/pdf/tidb-v5.2-en-manual.pdf
27+
https://docs-download.pingcap.com/pdf/tidb-v5.1-zh-manual.pdf
28+
https://docs-download.pingcap.com/pdf/tidb-v5.1-en-manual.pdf
29+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-dev-zh-manual.pdf
30+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-dev-en-manual.pdf
31+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-stable-zh-manual.pdf
32+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-stable-en-manual.pdf
33+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.5-zh-manual.pdf
34+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.5-en-manual.pdf
35+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.4-zh-manual.pdf
36+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.4-en-manual.pdf
37+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.3-zh-manual.pdf
38+
https://docs-download.pingcap.com/pdf/tidb-in-kubernetes-v1.3-en-manual.pdf
39+
https://docs-download.pingcap.com/pdf/tidbcloud-en-manual.pdf

0 commit comments

Comments
 (0)