Let’s not mince words: automating builds/releases/deployments makes development an awful lot simpler. All of the VS Code theme repos have the same yaml pipeline to publish them to the Visual Studio Gallery. Once you have gone through the process of setting up a publisher in the Visual Studio Gallery it’s straightforward to automate publishing packages.

In the code below you’ll see that there is a variable called $(POSTMAN) (no, idk why I called it this either), which is a PAT created specficially for publishing. This is set through the variables of a DevOps pipeline. I probably could use a variable group and reference that, but I’m lazy.

The process to generate a PAT is on the same page referenced earlier, but a little further up. It’s probably worth reading through the entire article, but those sections give you the gist of what’s happening.

  - master

  vmImage: 'ubuntu-latest'

name: $(BuildDefinitionName)_$(VersionNumber)_$(SourceBranchName)

  - name: BaseVersionNumber 
    value: "0.865"  
  - name: Minor 
    value: $[counter(variables['BaseVersionNumber'], 1)]
  - name: VersionNumber 
    value: $(BaseVersionNumber).$(Minor)
  - task: PowerShell@2
    displayName: "Update Build Number"
      targetType: 'inline'
      script: |
          Write-Host "##vso[build.updatebuildnumber]$BuildName"

  - task: Bash@3
    displayName: "Package and Publish VS Code Theme"
      targetType: 'inline'
      script: |
        npm install -g [email protected]
        echo $PAT
        git config user.email "[email protected]"
        git config user.name "RichieBzzzt"
        sudo npm install -g vsce
        vsce package
        vsce publish $(VersionNumber) -p $PAT
      failOnStderr: false
      workingDirectory: $(System.DefaultWorkingDirectory)
      PAT: $(POSTMAN)

  - task: CopyFiles@2
    displayName: "Copy Files to: $(build.artifactstagingdirectory)"
      Contents: |
      TargetFolder: "$(build.artifactstagingdirectory)"
  - task: PublishBuildArtifacts@1
    displayName: "Publish Artifact: sofetch"
      ArtifactName: sofetch