139 lines
5.3 KiB
YAML
139 lines
5.3 KiB
YAML
name: Test Eclipse Distro GChat Message
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: version
|
|
required: true
|
|
default: 4.29.0
|
|
type: string
|
|
eclipse_profile:
|
|
description: Eclipse profile 'e435' etc
|
|
required: true
|
|
default: 'e435'
|
|
type: string
|
|
build_type:
|
|
description: Build type such as 'snapshot', 'milestone' or 'release'
|
|
required: true
|
|
default: 'release'
|
|
type: string
|
|
p2_path:
|
|
description: p2 path
|
|
default: 'release/TOOLS/sts4/update/4.29.0.RELEASE/e4.35'
|
|
required: true
|
|
type: string
|
|
dist_path:
|
|
description: distro path
|
|
default: 'release/STS4/4.29.0.RELEASE/dist/e4.35'
|
|
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:
|
|
gchat-message:
|
|
name: Send GChat message
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Google Chat Notification
|
|
run: |
|
|
echo "P2 Update Site: ${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}"
|
|
downloads_html="sts4-distro-downloads-${{ inputs.eclipse_profile }}.txt"
|
|
rm -f ./downloads_html
|
|
s3_url=s3://${AWS_S3_BUCKET}/${{ inputs.dist_path }}
|
|
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`
|
|
s3_url_prefix="s3://${AWS_S3_BUCKET}"
|
|
s3_url_prefix_length=${#s3_url_prefix}
|
|
for file in $files
|
|
do
|
|
if [[ "$file" =~ ^"${s3_url_prefix}" ]]; then
|
|
download_url=${DOWNLOAD_URL_ROOT}${file:$s3_url_prefix_length}
|
|
filename=${file:${#s3_url}+1}
|
|
echo $download_url
|
|
echo $filename
|
|
echo "<a href=${download_url}>${filename}</a>" >> $downloads_html
|
|
fi
|
|
done
|
|
distro_links=`cat ./$downloads_html`
|
|
rm -f ./$downloads_html
|
|
|
|
build_type=${{ inputs.build_type }}
|
|
build_type=${build_type^}
|
|
eclipse_profile=${{ inputs.eclipse_profile }}
|
|
eclipse_version=${eclipse_profile:1:1}.${eclipse_profile:2}
|
|
|
|
curl --location --request POST '${{ secrets.TOOLS_TEAM_GCHAT_WEBHOOK_URL }}' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw "{
|
|
\"cards\": [
|
|
{
|
|
\"header\": {
|
|
\"title\": \"STS ${{ inputs.version }} ${build_type}\",
|
|
\"subtitle\": \"Eclipse ${eclipse_version}\",
|
|
\"imageUrl\": \"https://avatars.githubusercontent.com/u/317776?s=48&v=4\",
|
|
},
|
|
\"sections\": [
|
|
{
|
|
\"widgets\": [
|
|
{
|
|
\"keyValue\": {
|
|
\"topLabel\": \"P2 Update Site\",
|
|
\"content\": \"<a href=${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}>${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}</a>\"
|
|
}
|
|
},
|
|
{
|
|
\"keyValue\": {
|
|
\"topLabel\": \"Distributions\",
|
|
\"content\": \"${distro_links}\",
|
|
\"contentMultiline\": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}"
|
|
|
|
curl --location --request POST '${{ secrets.TOOLS_TEAM_GCHAT_WEBHOOK_URL }}' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw "{
|
|
\"cardsV2\": [
|
|
{
|
|
\"card\": {
|
|
\"header\": {
|
|
\"title\": \"STS ${{ inputs.version }} ${build_type}\",
|
|
\"subtitle\": \"Eclipse ${eclipse_version}\",
|
|
\"imageUrl\": \"https://avatars.githubusercontent.com/u/317776?s=48&v=4\",
|
|
},
|
|
\"sections\": [
|
|
{
|
|
\"widgets\": [
|
|
{
|
|
\"decoratedText\": {
|
|
\"topLabel\": \"P2 Update Site\",
|
|
\"text\": \"<a href=${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}>${DOWNLOAD_URL_ROOT}/${{ inputs.p2_path }}</a>\"
|
|
}
|
|
},
|
|
{
|
|
\"decoratedText\": {
|
|
\"topLabel\": \"Distributions\",
|
|
\"text\": \"${distro_links}\",
|
|
\"wrapText\": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}"
|