GHA: Upload to S3 and Akamai

This commit is contained in:
aboyko
2023-11-09 16:57:07 -05:00
parent 1477a3c352
commit 0673e24f00
4 changed files with 24 additions and 48 deletions

View File

@@ -1,18 +0,0 @@
# Akamai supports assumeRole for Cloudgate S3 access
# The script asks for temp credentials to be able to upload to Akamai S3 origin bucket
# The AWS CLI environment variables are then updated with temp credentials values
set -e
session_name=$1
duration_seconds=900
if [ ! -z "$2" ]; then
duration_seconds=$2
fi
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s" \
$(aws sts assume-role \
--role-arn arn:aws:iam::$TOOLS_CLOUDGATE_ACCOUNT_ID:role/$TOOLS_CLOUDGATE_USER \
--role-session-name $session_name \
--duration-seconds $duration_seconds \
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \
--output text))

View File

@@ -2,14 +2,14 @@ dist_path=$1
eclipse_version=$2
build_type=$3
s3_url=s3://dist.springsource.com/${dist_path}
s3_url=s3://tools-spring-io/${dist_path}
downloads_html="sts4-nightly-${eclipse_version}.html"
files=`aws s3 cp ${s3_url} . --recursive --exclude "*" --include "spring-tool-suite-4*.zip" --include "spring-tool-suite-4*.dmg" --include "spring-tool-suite-4*.self-extracting.jar" --include "spring-tool-suite-4*.tar.gz" --exclude "*/*" --dryrun`
rm -f ./${downloads_html}
echo '<ul>' >> $downloads_html
for file in $files
do
if [[ "$file" =~ ^"s3://dist." ]]; then
if [[ "$file" =~ ^"s3://tools-spring-io" ]]; then
download_url=https://download${file:9}
filename=${file:${#s3_url}+1}
echo ' <li><a href="'${download_url}'">'${filename}'</li>' >> $downloads_html
@@ -17,4 +17,5 @@ do
done
echo '</ul>' >> $downloads_html
cat ./$downloads_html
aws s3 mv ./$downloads_html s3://dist.springsource.com/${build_type}/STS4/ --acl public-read --no-progress
aws s3 cp ./$downloads_html s3://dist.springsource.com/${build_type}/STS4/ --acl public-read --no-progress
aws s3 mv ./$downloads_html s3://tools-spring-io/${build_type}/STS4/ --no-progress