semantic-release-vsce
semantic-release plugin to package and publish VS Code extensions.
Step | Description |
---|
verify | Verify the presence and the validity of the authentication (set via environment variables) and the package.json |
prepare | Generate the .vsix file using vsce, this can be be controlled by providing packageVsix in config. Note: If the OVSX_PAT environment variable is set, this step will still run |
publish | Publish the extension |
Install
npm install --save-dev semantic-release-vsce
or
yarn add --dev semantic-release-vsce
Usage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"semantic-release-vsce",
{
"packageVsix": true
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "*.vsix",
"label": "Extension File"
}
]
}
]
]
}
Configuration
Option | Type | Description |
---|
packageVsix | boolean or string | If set to true , the plugin will generate a .vsix file. If is a string, it will be used as value for --out of vsce package . |
Environment Variables
Variable | Description |
---|
VSCE_PAT | Required. The personal access token to publish the extension of VS Code Marketplace |
OVSX_PAT | Optional. The personal access token to push to OpenVSX |
Publishing to OpenVSX
Publishing extensions to OpenVSX using this plugin is easy:
-
Get a valid personal access token with the correct privileges to the publisher namespace in OpenVSX. In order to get the personal access token, check this page.
-
Configure the OVSX_PAT
environment variable in your CI with the token that you created.
-
The plugin will automatically detect the environment variable and it will publish to OpenVSX, no additional configuration is needed. Enjoy!
Github Actions Example
name: release
on:
push:
branches: [master]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Node Dependencies
run: npm ci
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}