Skip to content

Publish VSCode Extension #8

Publish VSCode Extension

Publish VSCode Extension #8

name: Publish VSCode Extension
on:
workflow_dispatch:
inputs:
extension-name:
description: name of the extension, e.g. vscode-spring-cli
required: true
type: string
version:
description: version of the extension
required: true
type: string
postfix:
description: For example "RC1"
required: true
type: string
env:
DOWNLOAD_URL_ROOT: https://cdn.spring.io
VSIX_FILE: ${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix
URL_PATH: spring-tools/release/vscode-extensions/${{ inputs.extension-name }}/${{ inputs.version }}
GCP_BUCKET: gs://cdn-spring-io
jobs:
publish-release:
runs-on: ubuntu-latest
name: Publish '${{ inputs.extension-name }}-${{ inputs.version }}-${{ inputs.postfix }}.vsix'
steps:
- name: Use Node.js 22.x
uses: actions/setup-node@v3
with:
node-version: 22.x
- name: Download Release VSIX
id: download-release
run: |
wget $DOWNLOAD_URL_ROOT/$URL_PATH/$VSIX_FILE
- name: Publish to VSCode Marketplace
id: publish-vsce
run: |
npm install --global @vscode/vsce
vsce publish -p ${{ secrets.VSCE_PUBLISH_TOKEN }} --packagePath $VSIX_FILE
- name: Publish to Eclipse Open VSX
id: publish-ovsx
run: |
npm install --global ovsx
ovsx publish -p ${{ secrets.OVSX_PUBLISH_TOKEN }} $VSIX_FILE
- name: Upload to GCP
run: |
echo '${{ secrets.CDN_SPRING_IO_BACKUP_GCP_BUCKET_JSON }}' > ./gcp.json
gcloud auth activate-service-account --key-file=./gcp.json
rm -f gcp.json
gcloud storage cp $VSIX_FILE $GCP_BUCKET/$URL_PATH/$VSIX_FILE
- id: tools-team-slack
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ secrets.VMWARE_SLACK_BOT_TOKEN }}
with:
channel-id: "C0188MENU2J"
payload: |
{
"text": "Published release `$VSIX_FILE`",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Published release `$VSIX_FILE`<https://marketplace.visualstudio.com/items?itemName=vmware.${{ inputs.extension-name }}|${{ inputs.extension-name }}>"
}
}
]
}
- 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\": \"Published `${VSIX_FILE}`\",
\"imageUrl\": \"https://code.visualstudio.com/assets/images/code-stable.png\",
},
\"sections\": [
{
\"widgets\": [
{
\"keyValue\": {
\"topLabel\": \"VSCode Marketplace\",
\"content\": \"<a href=\"https://marketplace.visualstudio.com/items?itemName=vmware.${{ inputs.extension-name }}|${{ inputs.extension-name }}\">${VSIX_FILE}</a>\",
\"contentMultiline\": true
}
},
{
\"keyValue\": {
\"topLabel\": \"Open VSX Registry\",
\"content\": \"<a href=\"https://open-vsx.org/extension/VMware/${{ inputs.extension-name }}\">${VSIX_FILE}</a>\",
\"contentMultiline\": true
}
}
]
}
]
}
]
}"