|
| 1 | +name: Test Eclipse Distro GChat Message |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + eclipse_profile: |
| 7 | + description: Eclipse profile 'e429' etc |
| 8 | + required: true |
| 9 | + default: 'e429' |
| 10 | + type: string |
| 11 | + build_type: |
| 12 | + description: Build type such as 'snapshot', 'milestone' or 'release' |
| 13 | + required: true |
| 14 | + default: 'snapshot' |
| 15 | + type: string |
| 16 | + p2-path: |
| 17 | + description: p2 path example `release/TOOLS/sts4/update/4.24.0.RELEASE/e4.32` |
| 18 | + required: true |
| 19 | + type: string |
| 20 | + dist-path: |
| 21 | + description: distro path `release/STS4/4.24.0.RELEASE/dist/e4.32` |
| 22 | + required: true |
| 23 | + type: string |
| 24 | + |
| 25 | +env: |
| 26 | + AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }} |
| 27 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }} |
| 28 | + AWS_DEFAULT_REGION: us-east-1 |
| 29 | + AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }} |
| 30 | + AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools |
| 31 | + DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools |
| 32 | + |
| 33 | +jobs: |
| 34 | + gchat-message: |
| 35 | + name: Send GChat message |
| 36 | + runs-on: ubuntu-latest |
| 37 | + steps: |
| 38 | + - name: Google Chat Notification |
| 39 | + run: | |
| 40 | + echo "P2 Update Site: ${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}" |
| 41 | + downloads_md="sts4-distro-downloads-${{ inputs.eclipse_profile }}.txt" |
| 42 | + rm -f ./${downloads_html} |
| 43 | + s3_url=s3://${AWS_S3_BUCKET}/${{ inputs.dist_path }} |
| 44 | + 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` |
| 45 | + s3_url_prefix="s3://${AWS_S3_BUCKET}" |
| 46 | + s3_url_prefix_length=${#s3_url_prefix} |
| 47 | + for file in $files |
| 48 | + do |
| 49 | + if [[ "$file" =~ ^"${s3_url_prefix}" ]]; then |
| 50 | + download_url=${DOWNLOAD_URL_ROOT}${file:$s3_url_prefix_length} |
| 51 | + filename=${file:${#s3_url}+1} |
| 52 | + echo '<a href="${download_url}">${filename}</a>' >> $downloads_html |
| 53 | + fi |
| 54 | + done |
| 55 | + cat ./$downloads_html |
| 56 | + rm -f ./${downloads_html} |
| 57 | +
|
0 commit comments