Skip to content

Build VSCode Extension #21

Build VSCode Extension

Build VSCode Extension #21

name: Build VSCode Extension
on:
workflow_dispatch:
inputs:
extension-name:
description: name of the extension, e.g. vscode-spring-cli
required: true
type: string
dist:
description: release, pre, snapshot
required: false
type: string
default: snapshot
permissions:
contents: write
jobs:
build-vscode-extension:
runs-on: ubuntu-latest
name: Build VSCode Extension '${{ inputs.extension-name }}'
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 }} ${{ inputs.dist }}
ls ./vsix
- name: Cloudgate S3 Configuration
if: always()
uses: aws-actions/configure-aws-credentials@v4
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: Upload Release
id: upload-release
if: ${{ inputs.dist == 'release' }}
run: |
pwd=`pwd`
cd vscode-extensions/${{ inputs.extension-name }}
base_version=`jq -r .version package.json`
cd $pwd
vsix_file=`ls ./vsix | head -n 1`
echo "VSIX file to upload ${vsix_file}"
s3_path=vscode-extensions/${{ inputs.extension-name }}/$base_version/${dist}
echo "S3 path: ${s3_path}"
aws s3 rm s3://tools-spring-io/$s3_path/ --recursive
aws s3 cp ./vsix/$vsix_file s3://tools-spring-io/$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
- id: tools-team-slack
if: ${{ inputs.dist == 'release' }}
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.VMWARE_SLACK_BOT_TOKEN }}
with:
channel-id: "C0188MENU2J"
payload: |
{
"text": "Release build `${{ inputs.extension-name }}-${{ steps.upload-release.outputs.version }}`",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Release build for `${{ inputs.extension-name }}-${{ steps.upload-release.outputs.version }}` is available: ${{ steps.upload-release.outputs.s3_url }}"
}
}
]
}