Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing VS Code extension via Azure DevOps

After reading VSCode Publish Extension docs, I've succeeded to publish a VSCode extension manually with vsce.

I'm wondering if there is a way to publish extensions automatically via Azure DevOps pipelines (build or release) instead of doing it manually.

I've tried to use vsce there but I'm getting an authentication error

Resource not available for anonymous access. Client authentication required.

Using vsce publish -p <access_token> is not possible because the pipeline is public and everyone can see the access token...

So, is there a way to publish a Visual Studio Code extension automatically via Azure DevOps Pipeline or even Travis CI?

like image 855
nrofis Avatar asked Oct 29 '25 18:10

nrofis


1 Answers

You can add the Personal Access Token as a secret variable, then nobody can couldn't see it.

Go to Azure DevOps to your pipeline and click on "Edit", not in the top left click on "Variables":

enter image description here

Now click on the + icon and add the variable, mark the checkbox "Keep this value secret":

enter image description here

Now you can use it in this way: $(PAT), for example:

vsce publish -p $(PAT)

The variable value will not appear in the YAML :)

like image 99
Shayki Abramczyk Avatar answered Oct 31 '25 13:10

Shayki Abramczyk