6 Nightly Build
Alex Ross редактировал(а) эту страницу 2021-12-10 14:15:42 +01:00

The nightly build has been deprecated in favor of the pre-release build.

Azure Pipeline setup

Firstly, you need a Azure Devops organization, which you probably already have as it's necessary for publishing an VS Code extension to the marketplace. Then you need to create a project if you haven't done that yet

image

Secondly we need to create a build pipeline:

  • Link with a git repository
  • Choose a template to start from

image

VS Code extensions are Nodejs applications so we can choose the Nodejs template or an empty one for better customization.

Tasks/Configuration

Once we create a build pipeline, the next step is setting up customized tasks, here is an overall look of GH PR nightly build's pipeline

image

For every task, we need to specific a task runner. We used three different task runners in our pipeline

  • Node Tool Installer.
  • Yarn Tool Installer as we use Yarn in our project
  • Command Line. For all other tasks, we write our own shell scripts.
image

Install Dependencies

yarn
yarn vsce

vsce is necessary here as we are going to publish from command line.

Generate Package.json

As mentioned at the very beginning, the nightly build will be a new extension, so there are two properties we need to modify

  • Extension ID
  • Version

Updating the extension id is easy, for example, we change vscode-pull-request-github to vscode-pull-request-github-insiders. While updating the version is a bit more complex but still straightforward

  1. Every nightly build has an unique version
  2. The version only increments
  3. We are still able to publish manually

Update. The version will be YEAR.MONTH.MINUTES-IN-MONTH, so we can generate an unique version for every minute, even if we attempt to publish a new release manually, the version is still guaranteed correct.

Publish

To publish through command line, we need to pass in Personal Access Token through Environment Variable again. Apparently we don't want to put the PAT in source code.

The current token has a lifetime of a year, and will expire on 3/11/2021. When this happens, generate a new token using these instructions. From the pipeline's page, click edit, variables, and then update the value of vsce.token to the new string.

Trigger/Schedule

Once we have the build pipeline setup, we can save the configuration in a yml file and push that to our repository (xterm example), but you don't necessarily need to if you have some customized scripts you don't want to expose.

The last step is setting triggers for the pipeline. The one we use for GH PR nightly build is

  • Every Mon to Fri 8:00 from master
  • Only when there are new commit after the last version
image

PAT expiration

To publish the extension, the pipeline takes a vsce access token as a variable.