Publish VSCode Extension Pack #1
This file contains hidden or 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: Publish VSCode Extension Pack | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| extension-name: | |
| description: name of the extension pack, e.g. 'boot-dev-pack' | |
| required: true | |
| type: string | |
| tag: | |
| description: tag the git repo if value is 'true' | |
| required: true | |
| type: boolean | |
| permissions: | |
| contents: write | |
| env: | |
| DOWNLOAD_URL_ROOT: https://cdn.spring.io | |
| URL_PATH: spring-tools/release/vscode-extensions/${{ inputs.extension-name }}/${{ inputs.version }} | |
| GCP_BUCKET: gs://cdn-spring-io | |
| jobs: | |
| publish-vscode-extension-pack: | |
| runs-on: ubuntu-latest | |
| name: Publish vscode extension pack '${{ 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` | |
| package_name=`jq -r .name vscode-extensions/${{ inputs.extension-name }}/package.json` | |
| release_name=$package_name-$base_version | |
| echo "Version: ${base_version}" | |
| echo "Release Name: ${release_name}" | |
| echo "version=$base_version" >> $GITHUB_OUTPUT | |
| echo "release_name=$release_name" >> $GITHUB_OUTPUT | |
| echo "vsix_file=$release_name.vsix" >> $GITHUB_OUTPUT | |
| echo "package_name=$package_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 | |
| }) | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Publish to VSCode Marketplace | |
| id: publish-vsce | |
| run: | | |
| npm install --global @vscode/vsce | |
| cd vscode-extensions/${{ inputs.extension-name }} | |
| vsce package | |
| vsce publish -p ${{ secrets.VSCE_PUBLISH_TOKEN }} --packagePath ${{ steps.version.outputs.vsix_file }} | |
| - name: Publish to Eclipse Open VSX | |
| id: publish-ovsx | |
| run: | | |
| npm install --global ovsx | |
| cd vscode-extensions/${{ inputs.extension-name }} | |
| ovsx publish -p ${{ secrets.OVSX_PUBLISH_TOKEN }} ${{ steps.version.outputs.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 | |
| cd vscode-extensions/${{ inputs.extension-name }} | |
| gcloud storage cp ${{ steps.version.outputs.vsix_file }} $GCP_BUCKET/$URL_PATH/${{ steps.version.outputs.vsix_file }} | |
| - 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 `${{ steps.version.outputs.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.${{ steps.version.outputs.package_name }}|${{ steps.version.outputs.package_name }}>${{ steps.version.outputs.vsix_file }}</a>\", | |
| \"contentMultiline\": true | |
| } | |
| }, | |
| { | |
| \"keyValue\": { | |
| \"topLabel\": \"Open VSX Registry\", | |
| \"content\": \"<a href=https://open-vsx.org/extension/VMware/${{ steps.version.outputs.package_name }}>${{ steps.version.outputs.vsix_file }}</a>\", | |
| \"contentMultiline\": true | |
| } | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| }" |