From 31b12d8b47cd8944bf4293a252b9ee51969fc2b7 Mon Sep 17 00:00:00 2001 From: aboyko Date: Fri, 12 Jul 2024 20:55:40 -0400 Subject: [PATCH] [GHA] Prepare to run VSCode extension snapshot builds --- .github/scripts/gen-vscode-link-bullet.sh | 8 +++ .github/workflows/build-vscode-extension.yml | 4 +- .../workflows/snapshot-vscode-extension.yml | 58 +++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100755 .github/scripts/gen-vscode-link-bullet.sh create mode 100644 .github/workflows/snapshot-vscode-extension.yml diff --git a/.github/scripts/gen-vscode-link-bullet.sh b/.github/scripts/gen-vscode-link-bullet.sh new file mode 100755 index 000000000..130ca27ae --- /dev/null +++ b/.github/scripts/gen-vscode-link-bullet.sh @@ -0,0 +1,8 @@ +id=$1 +label=$2 +download_url_root=$3 + +vsix_file=`aws s3 cp s3://$AWS_S3_BUCKET/snapshot/vscode-extensions/$id/ . --exclude "*" --include "*.vsix" --exclude "*/*" --dryrun | head -n 1` +if [ ! -z "${vsix_file}" ]; then + echo "
  • ${label}: ${vsix_file}
  • " +fi \ No newline at end of file diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 765d1bf99..2bd75db13 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -43,7 +43,7 @@ jobs: run: | ${{ github.workspace }}/.github/scripts/build-vscode-extension.sh ${{ inputs.extension-name }} ${{ inputs.dist }} ls ./vsix - - name: Upload Release + - name: Upload VSIX id: upload-release if: ${{ inputs.dist == 'release' }} run: | @@ -58,7 +58,7 @@ jobs: aws s3 rm s3://$AWS_S3_BUCKET/$s3_path/ --recursive aws s3 cp ./vsix/$vsix_file s3://$AWS_S3_BUCKET/$s3_path/$vsix_file --no-progress echo "version=$base_version" >> $GITHUB_OUTPUT - echo "s3_url=https://cdn.spring.io/spring-tools/$s3_path/$vsix_file" >> $GITHUB_OUTPUT + echo "s3_url=${DOWNLOAD_URL_ROOT}/$s3_path/$vsix_file" >> $GITHUB_OUTPUT - id: tools-team-slack if: ${{ inputs.dist == 'release' }} uses: slackapi/slack-github-action@v1.26 diff --git a/.github/workflows/snapshot-vscode-extension.yml b/.github/workflows/snapshot-vscode-extension.yml new file mode 100644 index 000000000..8037ed977 --- /dev/null +++ b/.github/workflows/snapshot-vscode-extension.yml @@ -0,0 +1,58 @@ +name: Snapshot VSCode Extension + +on: + workflow_call: + inputs: + extension-name: + description: name of the extension, e.g. vscode-spring-cli + required: true + type: string + +permissions: + contents: write + +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: + build-vscode-extension: + runs-on: ubuntu-latest + name: Build VSCode Extension '${{ inputs.extension-name }}' Snapshot + steps: + - name: Checkout vscode-extensions code and workflow scripts + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Build .VSIX file + id: build-vsix + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ${{ github.workspace }}/.github/scripts/build-vscode-extension.sh ${{ inputs.extension-name }} snapshot + ls ./vsix + - name: Upload VSIX + id: upload-release + run: | + vsix_file=`ls ./vsix | head -n 1` + echo "VSIX file to upload ${vsix_file}" + s3_path=snapshot/vscode-extensions/${{ inputs.extension-name }} + echo "S3 path: ${s3_path}" + aws s3 rm s3://$AWS_S3_BUCKET/$s3_path/ --recursive + aws s3 cp ./vsix/$vsix_file s3://$AWS_S3_BUCKET/$s3_path/$vsix_file --no-progress + - name: Update Nightly Builds download page + run: | + downloads_html="vscode-extensions-snippet.html" + echo '' >> $downloads_html + cat ./$downloads_html +