iterative/vscode-dvc

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: Publish Extension

on:
  workflow_dispatch:
  pull_request:
    types: [closed]

jobs:
  deploy:
    if: |
      github.event_name == 'workflow_dispatch' || 
      (github.event.pull_request.merged == true && 
      github.event.pull_request.title == 'Update version and CHANGELOG for release')
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - name: Checkout
        id: checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set Variables
        id: set_variables
        run: |
          echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

      - name: Setup Node.js environment
        uses: actions/setup-node@v4
        with:
          node-version: '16'
          cache: 'yarn'
          
      - run: yarn install
      - run: yarn build

      - name: Upload VSIX
        uses: actions/upload-artifact@v4
        with:
          name: dvc.vsix
          path: ./extension/dvc.vsix

      - name: Publish to Visual Studio Marketplace
        uses: HaaLeo/publish-vscode-extension@v1
        with:
          extensionFile: './extension/dvc.vsix'
          pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
          registryUrl: https://marketplace.visualstudio.com

      - name: Publish to Open VSX Registry
        uses: HaaLeo/publish-vscode-extension@v1
        with:
          extensionFile: './extension/dvc.vsix'
          pat: ${{ secrets.OPEN_VSX_TOKEN }}

      - name: Get Most Recent Changelog Entry
        id: changelog_reader
        uses: mindsers/changelog-reader-action@v2

      - name: Create Github Release
        uses: ncipollo/release-action@v1
        with:
          body: ${{ steps.changelog_reader.outputs.changes }}
          commit: ${{ steps.set_variables.outputs.commit }}
          name: ${{ steps.changelog_reader.outputs.version }}
          tag: ${{ steps.changelog_reader.outputs.version }}
          token: ${{ secrets.GITHUB_TOKEN }}