konveyor / editor-extensions

Developer experience stuff, like VSCode Extension, for Konveyor.
Apache License 2.0
0 stars 5 forks source link

vscode extension release automation #11

Open djzager opened 4 days ago

djzager commented 4 days ago

We need to set up an automated process to package our VSCode extension and prepare it for publishing to both the VSCode Marketplace and the Open VSX Registry. This will ensure that every push to main and every new release results in a packaged extension, ready for installation and distribution.

Tasks:

  1. Automated Packaging:

    Steps to automate packaging:

    • Set up a GitHub Actions workflow that runs on push to main and release events.
    • The workflow should:
      • Install dependencies (e.g., npm install).
      • Run vsce package to bundle the extension.
      • If required, create a release artifact for downloading the packaged .vsix file.

    Example GitHub Actions workflow:

    name: Package VSCode Extension
    
    on:
     push:
       branches:
         - main
     release:
       types: [created]
    
    jobs:
     build:
       runs-on: ubuntu-latest
    
       steps:
         - name: Checkout code
           uses: actions/checkout@v2
    
         - name: Set up Node.js
           uses: actions/setup-node@v3
           with:
             node-version: '16'
    
         - name: Install dependencies
           run: npm install
    
         - name: Package extension
           run: npx vsce package
    
         - name: Upload VSIX as artifact (optional)
           uses: actions/upload-artifact@v2
           with:
             name: my-extension
             path: '*.vsix'
  2. Publishing to the VSCode Marketplace:

    • Create issues to handle the steps required for publishing to the VSCode Marketplace.
    • Publishing requires a publisher account and a Personal Access Token (PAT) from Azure DevOps to authenticate with the marketplace.
    • Documentation for publishing to the VSCode Marketplace:
    • Steps include:
      • Setting up a publisher account.
      • Acquiring a Personal Access Token (PAT) from Azure DevOps.
      • Using the vsce publish command in the GitHub Actions workflow to automatically publish the extension.

    Example workflow snippet for publishing:

    - name: Publish to VSCode Marketplace
     run: npx vsce publish -p ${{ secrets.VSCE_TOKEN }}
  3. Publishing to the Open VSX Registry:

    • Create issues for tracking the requirements to publish to Open VSX Registry.
    • Open VSX requires a publisher account as well and uses token-based authentication.
    • Documentation for publishing to Open VSX:
    • Steps include:
      • Creating an Open VSX publisher account.
      • Acquiring a token from the Open VSX registry.
      • Using the ovsx command in the GitHub Actions workflow to publish the extension.

    Example workflow snippet for publishing:

    - name: Publish to Open VSX
     run: npx ovsx publish --pat ${{ secrets.OVSX_TOKEN }}

Definition of Done:

djzager commented 4 days ago

https://code.visualstudio.com/api/working-with-extensions/publishing-extension

djzager commented 2 days ago

https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages