Intro
This post is going to be a bit of a brain dump about developing my VS Code extension, branching strategy for pre-releases and releases and using GitHub actions to stitch it all together.
If you’re only here for the AL / Business Central content then you might want to give this one a miss. Then again, Microsoft are increasingly using GitHub for AL projects themselves (e.g. AL-Go for GitHub) – so it might be worth a look after all.
Objectives
What am I trying to achieve? I want to have a short turn around of:
- Have an idea for a new feature
- Implement the feature
- Test it and make it available for others to test
- Release
I use the extension pretty much every day at work so I am my own biggest customer. I want to write some new feature and start working with it in a pre-release myself to find any issues before I release it.
I also want to have a little fun with a side-project – learn a little typescript, practice some CI/CD, GitHub Actions and Application Insights. If anyone else finds the extension useful as well then that’s a bonus.
Overview
This is my workflow. I want to get the feature into the pre-release version of the extension on the marketplace quickly. That way I will get the new pre-release myself from the marketplace and use it in my daily work. I’ll make any fixes or improvements in updates to the pre-release before merging the code to the release version and publishing to the marketplace.

GitHub Actions
The GitHub actions definition is fairly self-explanatory. The yaml is bellow, or here if you prefer. Run whenever some code is pushed. Build, test, package with npm
and vsce
. Run the PowerShell tests with Pester. Upload the built extension as an artifact. If the pre-release
branch is being built then use vsce
to publish to the marketplace with the --pre-release
switch.
The actions definition in the master
branch is similar but publishes to the marketplace without the --pre-release
switch.
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: npm install, build and test
run: |
npm install
npm run build
npm test
- name: package with vsce
run: |
npm install -g vsce
vsce package
- name: run pester tests
shell: pwsh
run: |
Set-PSRepository psgallery -InstallationPolicy Trusted
Install-Module Pester
Install-Module bccontainerhelper
gci *ALTestRunner.psm1 -Recurse | % {$_.FullName; Import-Module $_.FullName}
Invoke-Pester
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.1.4
with:
name: AL Test Runner
path: ./*.vsix
- name: Publish to marketplace
if: github.ref == 'refs/heads/pre-release'
run: |
vsce publish -p ${{ secrets.VSCE_PAT }} --pre-release
The personal access token for my Visual Studio account (used to publish to the marketplace) is stored in a repository secret.

You can create and update these from the settings for the repository. You can read more about creating the personal access token and the option for publishing extensions to the marketplace here: https://code.visualstudio.com/api/working-with-extensions/publishing-extension

Conclusions
It is rewarding to make some changes to the extension, push them to GitHub and then 10-15 minutes later be able to use them in a new version of the extension which has been automatically published, downloaded and installed. It allows you to publish more frequently and with more confidence.