[cherry-pick] Display download url for BUILD_PACKAGE action (#22200)
Build Package Workflow / BUILD_PACKAGE (push) Has been cancelled Details
Code scanning - action / CodeQL-Build (push) Has been cancelled Details

Display download url for BUILD_PACKAGE action

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2025-07-24 14:25:05 +08:00 committed by GitHub
parent 4bc7f6796b
commit 8596b0956e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 0 deletions

View File

@ -3,7 +3,25 @@ set -x
set -e
function s3_to_https() {
local s3_url="$1"
if [[ "$s3_url" =~ ^s3://([^/]+)/(.+)$ ]]; then
local bucket="${BASH_REMATCH[1]}"
local path="${BASH_REMATCH[2]}"
# current s3 bucket is create in this region
local region="us-west-1"
echo "https://${bucket}.s3.${region}.amazonaws.com/${path}"
else
echo "Invalid S3 URL: $s3_url" >&2
return 1
fi
}
function uploader {
converted_url=$(s3_to_https "s3://$2/$1")
echo "download url $converted_url"
aws s3 cp $1 s3://$2/$1
}