Commit aaf7a88 1 parent 923f9f3 commit aaf7a88 Copy full SHA for aaf7a88
File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,33 @@ RELEASE_ID=$(curl -fsSL \
19
19
-H " X-GitHub-Api-Version: 2022-11-28" \
20
20
https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/" $TAG " | jq ' .["id"]' )
21
21
22
+ if [ -z " $RELEASE_ID " ]; then
23
+ echo " Failed to get release ID for tag $TAG "
24
+ exit 1
25
+ fi
26
+
27
+ # 获取现有资产列表
28
+ ASSET_ID=$( curl -fsSL \
29
+ -H " Accept: application/vnd.github+json" \
30
+ -H " Authorization: Bearer $GITHUB_TOKEN " \
31
+ -H " X-GitHub-Api-Version: 2022-11-28" \
32
+ https://api.github.com/repos/aliyun/aliyun-cli/releases/$RELEASE_ID /assets | jq -r " .[] | select(.name == \" $( basename " $ASSET " ) \" ) | .id" )
33
+
34
+ # 如果资产已存在,删除它
35
+ if [ -n " $ASSET_ID " ]; then
36
+ echo " Asset already exists. Deleting asset ID $ASSET_ID "
37
+ curl -fsSL \
38
+ -X DELETE \
39
+ -H " Accept: application/vnd.github+json" \
40
+ -H " Authorization: Bearer $GITHUB_TOKEN " \
41
+ -H " X-GitHub-Api-Version: 2022-11-28" \
42
+ https://api.github.com/repos/aliyun/aliyun-cli/releases/assets/$ASSET_ID
43
+ fi
44
+
45
+ printf " Uploading %s to release %s\n" " $ASSET " " $RELEASE_ID "
46
+
22
47
curl -fsSL \
23
- -X POST \
48
+ -X PUT \
24
49
-H " Accept: application/vnd.github+json" \
25
50
-H " Authorization: Bearer $GITHUB_TOKEN " \
26
51
-H " X-GitHub-Api-Version: 2022-11-28" \
You can’t perform that action at this time.
0 commit comments