Files
spring-tools/.github/workflows/aggregate-distro-update-sites.yml
2023-11-01 09:49:43 -04:00

57 lines
2.7 KiB
YAML

name: Aggregate Distro Update Sites
on:
workflow_call:
inputs:
version:
description: Version suffix in S3 (i.e. 4.19.1.RELEASE)
required: true
type: string
latest:
description: Latest eclipse release version (i.e. e4.28)
required: true
type: string
jobs:
update-aggregate-update-sites:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
sparse-checkout: |
.github
- name: Timestamp
id: timestamp
run: echo "date=`echo $(($(date +%s%N) / 1000000))`" >> $GITHUB_OUTPUT
- name: Generate and Upload Aggregate Update Sites Data
env:
AWS_ACCESS_KEY_ID: ${{ secrets.TOOLS_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TOOLS_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
run: |
dirs=`aws s3 ls s3://dist.springsource.com/release/TOOLS/sts4/update/${{ inputs.version }}/`
pattern='^e[0-9]+.[0-9]+/$'
for dir in $dirs
do
if [[ "$dir" =~ $pattern ]]; then
echo "Found ${dir}"
dir_name=${dir:0:-1}
site_url="https://download.springsource.com/release/TOOLS/sts4/update/${{ inputs.version }}/${dir_name}"
${{ github.workspace }}/.github/scripts/generate-composite-site-files.sh ${{ steps.timestamp.outputs.date }} $site_url
cat ./compositeArtifacts.xml
cat ./compositeContent.xml
if [[ ${dir_name} == ${{ inputs.latest }} ]]; then
aws s3 cp ./compositeArtifacts.xml s3://dist.springsource.com/release/TOOLS/sts4/update/latest/ --acl public-read
aws s3 cp ./compositeContent.xml s3://dist.springsource.com/release/TOOLS/sts4/update/latest/ --acl public-read
aws s3 cp ./p2.index s3://dist.springsource.com/release/TOOLS/sts4/update/latest/ --acl public-read
${{ github.workspace }}/.github/scripts/clear-s3-caches.sh release/TOOLS/sts4/update/latest
fi
aws s3 mv ./compositeArtifacts.xml s3://dist.springsource.com/release/TOOLS/sts4/update/${dir} --acl public-read
aws s3 mv ./compositeContent.xml s3://dist.springsource.com/release/TOOLS/sts4/update/${dir} --acl public-read
aws s3 mv ./p2.index s3://dist.springsource.com/release/TOOLS/sts4/update/${dir} --acl public-read
${{ github.workspace }}/.github/scripts/clear-s3-caches.sh release/TOOLS/sts4/update/${dir_name}
fi
done