feat(visual-studio) : add workflow for marketplace deployment #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Visual Studio Extension | |
| on: | |
| push: | |
| tags: | |
| - "vs-v*" | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| working-directory: visualstudio-extension | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup NuGet | |
| uses: nuget/setup-nuget@v2 | |
| - name: Restore NuGet packages | |
| run: nuget restore DevGlobe.sln | |
| - name: Build VSIX (Release) | |
| run: msbuild DevGlobe.sln /t:Rebuild /p:Configuration=Release /p:DeployExtension=false | |
| - name: Locate VSIX | |
| id: vsix | |
| shell: pwsh | |
| run: | | |
| $vsix = Get-ChildItem -Path . -Recurse -Filter *.vsix | | |
| Where-Object { $_.FullName -match 'bin\\Release' } | | |
| Select-Object -First 1 | |
| if (-not $vsix) { | |
| Write-Error "No .vsix found under bin\Release" | |
| exit 1 | |
| } | |
| Write-Host "Found VSIX: $($vsix.FullName)" | |
| "path=$($vsix.FullName)" >> $env:GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ steps.vsix.outputs.path }} | |
| body: | | |
| ## DevGlobe for Visual Studio | |
| Built from commit ${{ github.sha }} | |
| ### Install manually | |
| 1. Download the `.vsix` file below | |
| 2. Double-click it (or use **Extensions → Manage Extensions → Install from VSIX…**) | |
| 3. Restart Visual Studio | |
| generate_release_notes: true | |
| - name: Publish to Visual Studio Marketplace | |
| shell: pwsh | |
| env: | |
| # Réutilise le PAT Azure DevOps déjà utilisé pour VS Code (scope Marketplace › Manage, | |
| # compte propriétaire du publisher "devglobe"). Même type de token, même marketplace. | |
| MARKETPLACE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: | | |
| # Locate VsixPublisher.exe (ships with the VS SDK component) via vswhere. | |
| $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" | |
| $vsRoot = & $vswhere -latest -prerelease -property installationPath | |
| $publisher = Join-Path $vsRoot "VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe" | |
| if (-not (Test-Path $publisher)) { | |
| Write-Error "VsixPublisher.exe not found at $publisher" | |
| exit 1 | |
| } | |
| Write-Host "Using VsixPublisher: $publisher" | |
| & $publisher publish ` | |
| -payload "${{ steps.vsix.outputs.path }}" ` | |
| -publishManifest "publishManifest.json" ` | |
| -personalAccessToken $env:MARKETPLACE_PAT | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "VsixPublisher publish failed with exit code $LASTEXITCODE" | |
| exit $LASTEXITCODE | |
| } |