Skip to content

Commit 86df55a

Browse files
committed
Merge branch 'dev': aliyun CLI 凭证方式修正
2 parents 69d52e2 + e4bed9b commit 86df55a

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,14 @@ jobs:
185185
curl -sL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o /tmp/aliyun.tgz
186186
tar -xzf /tmp/aliyun.tgz -C /tmp
187187
188+
# 新版 aliyun CLI 的 oss 子命令已移除 -i/-k 短参数(会报
189+
# unknown flag -i),故改用非交互式 configure 写入 profile 携带凭证
190+
/tmp/aliyun configure set --profile ossci --mode AK --region cn-hangzhou \
191+
--access-key-id "$AK_ID" --access-key-secret "$AK_SECRET"
192+
188193
oss_cp() {
189194
/tmp/aliyun oss cp "$1" "oss://$OSS_BUCKET/downloads/$2" \
190-
--force -e "$OSS_ENDPOINT" -i "$AK_ID" -k "$AK_SECRET"
195+
--force -e "$OSS_ENDPOINT" --profile ossci
191196
}
192197
193198
cd release-windows-latest
@@ -225,13 +230,18 @@ jobs:
225230
# 预热失败不应推翻已成功的发布,仅标记警告
226231
continue-on-error: true
227232
env:
228-
ALIBABA_CLOUD_ACCESS_KEY_ID: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
229-
ALIBABA_CLOUD_ACCESS_KEY_SECRET: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
233+
AK_ID: ${{ secrets.ALIYUN_ACCESS_KEY_ID }}
234+
AK_SECRET: ${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
230235
FILE_NAME: ${{ steps.meta.outputs.file }}
231236
run: |
232237
set -eo pipefail
233-
curl -sL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o /tmp/aliyun.tgz
234-
tar -xzf /tmp/aliyun.tgz -C /tmp
238+
# 上一步可能被跳过(未配 OSS),故不假设 CLI 已存在
239+
if [ ! -x /tmp/aliyun ]; then
240+
curl -sL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o /tmp/aliyun.tgz
241+
tar -xzf /tmp/aliyun.tgz -C /tmp
242+
fi
243+
/tmp/aliyun configure set --profile cdnci --mode AK --region cn-hangzhou \
244+
--access-key-id "$AK_ID" --access-key-secret "$AK_SECRET"
235245
236246
BASE="${DOWNLOAD_BASE_URL%/}"
237247
# 预热安装包与 blockmap(差量更新依赖);
@@ -241,7 +251,7 @@ jobs:
241251
echo "$OBJECTS"
242252
243253
/tmp/aliyun cdn PushObjectCache \
244-
--region cn-hangzhou \
254+
--profile cdnci \
245255
--ObjectPath "$OBJECTS" \
246256
--Area domestic
247257

0 commit comments

Comments
 (0)