File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 2121 build_for_macosx :
2222 needs : [create_release]
2323 name : Build for MacOSX
24- runs-on : macos-12
24+ runs-on : macos-13
2525 env :
2626 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
2727 steps :
Original file line number Diff line number Diff line change @@ -19,8 +19,33 @@ RELEASE_ID=$(curl -fsSL \
1919 -H " X-GitHub-Api-Version: 2022-11-28" \
2020 https://api.github.com/repos/aliyun/aliyun-cli/releases/tags/" $TAG " | jq ' .["id"]' )
2121
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+
2247curl -fsSL \
23- -X POST \
48+ -X PUT \
2449 -H " Accept: application/vnd.github+json" \
2550 -H " Authorization: Bearer $GITHUB_TOKEN " \
2651 -H " X-GitHub-Api-Version: 2022-11-28" \
You can’t perform that action at this time.
0 commit comments