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 workflow_dispatch: 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 env: AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }} AWS_DEFAULT_REGION: us-east-1 AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }} AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools jobs: update-aggregate-update-sites: runs-on: ubuntu-latest outputs: invalid_urls: ${{ steps.gen-aggregate-sites.outputs.invalid_urls }} 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 id: gen-aggregate-sites env: CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} run: | echo "S3 Aggregate Update Sites Creation..." dirs=`aws s3 ls s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/${{ inputs.version }}/` echo "${dirs}" pattern='^e[0-9]+.[0-9]+/$' invalid_urls="" for dir in $dirs do if [[ "$dir" =~ $pattern ]]; then echo "Found ${dir}" dir_name=${dir:0:-1} site_url="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/${{ inputs.version }}/${dir_name}" if [[ ${dir_name} == "e4.30" ]]; then ${{ github.workspace }}/.github/scripts/generate-composite-site-files.sh ${{ steps.timestamp.outputs.date }} $site_url else ${{ github.workspace }}/.github/scripts/generate-composite-site-files.sh ${{ steps.timestamp.outputs.date }} $site_url true fi cat ./compositeArtifacts.xml cat ./compositeContent.xml if [[ ${dir_name} == ${{ inputs.latest }} ]]; then aws s3 cp ./compositeArtifacts.xml s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/latest/ --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/latest/compositeArtifacts.xml " aws s3 cp ./compositeContent.xml s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/latest/ --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/latest/compositeContent.xml " aws s3 cp ./p2.index s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/latest/ --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/latest/p2.index " echo "TODO: Purge Cache" fi aws s3 mv ./compositeArtifacts.xml s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/${dir} --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/${dir_name}/compositeArtifacts.xml " aws s3 mv ./compositeContent.xml s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/${dir} --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/${dir_name}/compositeContent.xml " aws s3 mv ./p2.index s3://${AWS_S3_BUCKET}/release/TOOLS/sts4/update/${dir} --checksum-algorithm CRC32 invalid_urls+="${DOWNLOAD_URL_ROOT}/release/TOOLS/sts4/update/${dir_name}/p2.index " fi done echo "invalid_urls=$invalid_urls" >> $GITHUB_OUTPUT - uses: ./.github/actions/cloudflare-purge name: Invalidate URLs with: urls: ${{ steps.gen-aggregate-sites.outputs.invalid_urls }} cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }} cloudflare_cache_token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}