Generate Nightly Downloads HTML #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Nightly Downloads HTML | |
# configure manual trigger | |
on: | |
workflow_dispatch: | |
jobs: | |
gen_html: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cloudgate S3 Configuration | |
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a | |
with: | |
aws-access-key-id: ${{ secrets.TOOLS_CLOUDGATE_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.TOOLS_CLOUDGATE_SECRET_KEY }} | |
role-to-assume: arn:aws:iam::${{ secrets.TOOLS_CLOUDGATE_ACCOUNT_ID }}:role/${{ secrets.TOOLS_CLOUDGATE_USER }} | |
role-session-name: ${{ github.run_id }} | |
aws-region: us-east-1 | |
role-duration-seconds: 900 | |
role-skip-session-tagging: true | |
- name: Update Nightly Distro Downloads page | |
run: | | |
dist_path="snapshot/STS4/nightly/dist/e4.28" | |
s3_url=s3://tools-spring-io/${dist_path}/ | |
downloads_html="sts4-nightly-e4.28.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` | |
echo '<ul>' >> $downloads_html | |
for file in $files | |
do | |
echo "entry: ${file}" | |
if [[ "$file" =~ ^"s3://spring-tools-io" ]]; then | |
download_url=https://cdn.spring.io/spring-tools${file:20} | |
filename=${file:${#s3_url}+1} | |
echo ' <li><a href="'${download_url}'">'${filename}'</li>' >> $downloads_html | |
fi | |
done | |
echo '</ul>' >> $downloads_html | |
cat ./$downloads_html | |
aws s3 mv ./$downloads_html s3://tools-spring-io/snapshot/STS4/ --dryrun | |
aws s3 ls s3://tools-spring-io/dist_path/ | |