Publishing your VSCode Extensions from GitHub Actions

GitHub GitHub Actions VSCode Extensions
post

This post is over a year old, some of this information may be out of date.

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.

When you got this PAT, add it as a GitHub Secret to your project.

Show image PAT Secret in GitHub
PAT Secret in GitHub

We will use this secret in the GitHub Actions workflow which looks as follows:

name: Release
on:
release:
types:
- published
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- name: Install the dependencies
run: npm i
- name: Install vsce
run: npm i -g vsce
- name: Publish
run: vsce publish -p ${{ secrets.VSCE_PAT }}

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

Solutions Architect & Developer Expert

Loading...

Let's build together

Manage content in VS Code

Present from VS Code

Engage with your audience throughout the event lifecycle