Release VSCode Extension #22
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: Release VSCode Extension | |
on: | |
workflow_dispatch: | |
inputs: | |
extension-name: | |
description: name of the extension, e.g. vscode-spring-cli | |
required: true | |
type: string | |
postfix: | |
description: For example "RC1" | |
required: true | |
type: string | |
tag: | |
description: tag the git repo if value is 'true' | |
required: true | |
type: boolean | |
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: | |
release-vscode-extension: | |
runs-on: ubuntu-latest | |
name: Release Build and Upload VSCode Extension '${{ inputs.extension-name }}' | |
steps: | |
- name: Checkout vscode-extension '${{ inputs.extension-name }}' | |
uses: actions/checkout@v4 | |
- name: Record Extension Version | |
id: version | |
run: | | |
base_version=`jq -r .version vscode-extensions/${{ inputs.extension-name }}/package.json` | |
release_name=${{ inputs.extension-name }}-$base_version-${{ inputs.postfix }} | |
echo "Version: ${base_version}" | |
echo "Release Name: ${release_name}" | |
echo "version=$base_version" >> $GITHUB_OUTPUT | |
echo "release_name=$release_name" >> $GITHUB_OUTPUT | |
- name: Create tag | |
if: ${{ inputs.tag }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ steps.version.outputs.release_name }}', | |
sha: context.sha | |
}) | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build .VSIX file | |
id: build-vsix | |
run: | | |
${{ github.workspace }}/.github/scripts/build-vscode-extension.sh ${{ inputs.extension-name }} release | |
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=release/vscode-extensions/${{ inputs.extension-name }}/${{ steps.version.outputs.version }} | |
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/${{ steps.version.outputs.release_name }}.vsix --no-progress | |
echo "s3_url=${DOWNLOAD_URL_ROOT}/$s3_path/${{ steps.version.outputs.release_name }}.vsix" >> $GITHUB_OUTPUT | |
# - id: tools-team-slack | |
# uses: slackapi/slack-github-action@v1.26 | |
# env: | |
# SLACK_BOT_TOKEN: ${{ secrets.VMWARE_SLACK_BOT_TOKEN }} | |
# with: | |
# channel-id: "C0188MENU2J" | |
# payload: | | |
# { | |
# "text": "Release build `${{ steps.version.outputs.release_name }}`", | |
# "blocks": [ | |
# { | |
# "type": "section", | |
# "text": { | |
# "type": "mrkdwn", | |
# "text": "Release build for `${{ steps.version.outputs.release_name }}` is available: ${{ steps.upload-release.outputs.s3_url }}" | |
# } | |
# } | |
# ] | |
# } | |
- name: GChat spring-tools-team notification | |
run: | | |
curl --location --request POST '${{ secrets.TOOLS_TEAM_GCHAT_WEBHOOK_URL }}' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"cards": [ | |
{ | |
"header": { | |
"title": "${{ inputs.extension-name }} ${{ steps.version.outputs.version }}", | |
"subtitle": "Release Candidate ${{ inputs.postfix }}", | |
"imageUrl": "https://code.visualstudio.com/assets/images/code-stable.png", | |
}, | |
"sections": [ | |
{ | |
"widgets": [ | |
{ | |
"textParagraph": { | |
"text": "VSCode extension <b>${{ inputs.extension-name }}</b> release candidate build <b>${{ inputs.postfix }}</b> is available: <a href=${{ steps.upload-release.outputs.s3_url }}>${{ steps.version.outputs.release_name }}.vsix</a>" | |
} | |
}, | |
{ | |
"buttons": [ | |
{ | |
"textButton": { | |
"text": "Download VSIX", | |
"onClick": { | |
"openLink": { | |
"url": "${{ steps.upload-release.outputs.s3_url }}" | |
} | |
} | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}' | |