Automation is key! That is how I think anyway. I’m not too fond of repetition, but for some reason, I had not yet automated my Visual Studio Code extension publishing. I always did this manually from my terminal by running vsce publish
.
With my latest extension, I thought, now is the time to automate this as well.
Setting up your workflow
When publishing your Code extensions, you need to use the Visual Studio Code Extension command-line tool: vsce
. Typically this is something you install locally by running npm i -g vsce
.
In this case, we will do this on GitHub Actions instead, but before you can start, you need to create your Personal Access Token or also called PAT.
ImportantGet your personal access token to publish to the VS Code Marketplace
When you got this PAT, add it as a GitHub Secret to your project.
We will use this secret in the GitHub Actions workflow which looks as follows:
|
|
InfoThe GitHub Actions workflow gets triggered whenever you create and publish a new release. In the last step, the PAT will be used to publish your extension.
ImportantMake sure to set the
publisher
to your account in thepackage.json
file. For me, this iseliostruyf
.