Skip to content

Commit 1045e24

Browse files
freelwfreelw
andauthored
Improve COS release upload reliability (#18)
Co-authored-by: freelw <“freelw81@qq.com“>
1 parent 1f46167 commit 1045e24

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
publish:
6262
needs: [build-macos, build-windows]
6363
runs-on: ubuntu-latest
64+
timeout-minutes: 30
6465
environment: cos-release
6566
steps:
6667
- uses: actions/checkout@v5

scripts/upload-release-to-cos.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,21 @@ curl --proto '=https' --tlsv1.2 --fail --silent --show-error --location --retry
3434
printf '%s %s\n' "${coscli_sha256}" "${coscli_path}" | sha256sum --check --strict
3535
chmod 0700 "${coscli_path}"
3636

37-
"${coscli_path}" cp "${source_dir}/" "cos://${COS_BUCKET}/${remote_path}/" \
38-
--recursive \
37+
while read -r _ file_name; do
38+
file_name="${file_name#\*}"
39+
[[ "${file_name}" != */* && -n "${file_name}" ]] || { echo "Invalid manifest filename: ${file_name}" >&2; exit 3; }
40+
"${coscli_path}" cp "${source_dir}/${file_name}" "cos://${COS_BUCKET}/${remote_path}/${file_name}" \
41+
--part-size 1 \
42+
--thread-num 4 \
43+
--endpoint "cos.${COS_REGION}.myqcloud.com" \
44+
--secret-id "${TENCENT_CLOUD_SECRET_ID}" \
45+
--secret-key "${TENCENT_CLOUD_SECRET_KEY}" \
46+
--init-skip=true \
47+
--disable-log
48+
done <"${source_dir}/SHA256SUMS"
49+
50+
# Publish the manifest last so clients never discover checksums for incomplete uploads.
51+
"${coscli_path}" cp "${source_dir}/SHA256SUMS" "cos://${COS_BUCKET}/${remote_path}/SHA256SUMS" \
3952
--endpoint "cos.${COS_REGION}.myqcloud.com" \
4053
--secret-id "${TENCENT_CLOUD_SECRET_ID}" \
4154
--secret-key "${TENCENT_CLOUD_SECRET_KEY}" \

0 commit comments

Comments
 (0)