Skip to content

Commit 24fbe02

Browse files
committed
feat: add COS backup functionality to production workflow
- Introduced a new input parameter `cos_backup` to enable backup deployment to a separate COS bucket. - Updated deployment steps to conditionally execute based on the `cos_backup` input, allowing for both standard and backup deployments. - Enhanced the deployment scripts to include backup logic for both general files and markdown files, ensuring comprehensive backup capabilities.
1 parent c4e487e commit 24fbe02

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/production.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ on:
2323
type: boolean
2424
default: false
2525
required: false
26+
cos_backup:
27+
description: "Backup to COS"
28+
type: boolean
29+
default: false
30+
required: false
2631

2732
concurrency: ci-prod
2833

@@ -117,6 +122,7 @@ jobs:
117122
chmod 755 coscli
118123
119124
- name: Deploy to COS
125+
if: ${{ !inputs.cos_backup }}
120126
run: |
121127
./coscli sync public/ cos://${{ secrets.TENCENTCLOUD_BUCKET_ID }} \
122128
--init-skip \
@@ -130,6 +136,7 @@ jobs:
130136
--force
131137
132138
- name: Deploy md to COS
139+
if: ${{ !inputs.cos_backup }}
133140
run: |
134141
./coscli sync public/ cos://${{ secrets.TENCENTCLOUD_BUCKET_ID }} \
135142
--init-skip \
@@ -142,6 +149,34 @@ jobs:
142149
--meta "Content-Type:text/plain; charset=utf-8" \
143150
--force
144151
152+
- name: Deploy to COS backup
153+
if: ${{ inputs.cos_backup }}
154+
run: |
155+
./coscli sync public/ cos://${{ secrets.TENCENTCLOUD_BACKUP_BUCKET_ID }} \
156+
--init-skip \
157+
--recursive \
158+
--routines 16 \
159+
--secret-id ${{ secrets.TENCENTCLOUD_SECRET_ID }} \
160+
--secret-key ${{ secrets.TENCENTCLOUD_SECRET_KEY }} \
161+
--endpoint cos.na-ashburn.myqcloud.com \
162+
--delete \
163+
--exclude ".*\.(md|txt)$" \
164+
--force
165+
166+
- name: Deploy md to COS backup
167+
if: ${{ inputs.cos_backup }}
168+
run: |
169+
./coscli sync public/ cos://${{ secrets.TENCENTCLOUD_BACKUP_BUCKET_ID }} \
170+
--init-skip \
171+
--recursive \
172+
--routines 16 \
173+
--secret-id ${{ secrets.TENCENTCLOUD_SECRET_ID }} \
174+
--secret-key ${{ secrets.TENCENTCLOUD_SECRET_KEY }} \
175+
--endpoint cos.na-ashburn.myqcloud.com \
176+
--include ".*\.(md|txt)$" \
177+
--meta "Content-Type:text/plain; charset=utf-8" \
178+
--force
179+
145180
cdn-refresh:
146181
needs: build
147182
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)