|
41 | 41 | Copy-Item "vsix_template\extension.vsixmanifest" $staging |
42 | 42 | Copy-Item "vsix_template\OffensiveVS360.pkgdef" $staging |
43 | 43 | Copy-Item "vsix_template\Content_Types.xml" "$staging\[Content_Types].xml" |
| 44 | + Copy-Item "README.md" $staging |
44 | 45 |
|
45 | 46 | Get-ChildItem -Recurse $staging | ForEach-Object { Write-Host $_.FullName } |
46 | 47 | Compress-Archive -Path "$staging\*" -DestinationPath "OffensiveVS360.vsix" -Force |
|
53 | 54 | path: OffensiveVS360.vsix |
54 | 55 | if-no-files-found: error |
55 | 56 | retention-days: 30 |
| 57 | + |
| 58 | + - name: Publish to Visual Studio Marketplace |
| 59 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') |
| 60 | + shell: pwsh |
| 61 | + env: |
| 62 | + MARKETPLACE_PAT: ${{ secrets.MARKETPLACE_PAT }} |
| 63 | + run: | |
| 64 | + # Find VsixPublisher.exe from the Visual Studio installation |
| 65 | + $vsixPublisher = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` |
| 66 | + -latest -products * -requires Microsoft.VisualStudio.Component.VSSDK ` |
| 67 | + -find "VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe" 2>$null |
| 68 | +
|
| 69 | + if (-not $vsixPublisher) { |
| 70 | + # Try common VS 2022 paths |
| 71 | + $candidates = @( |
| 72 | + "${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe", |
| 73 | + "${env:ProgramFiles}\Microsoft Visual Studio\2022\Professional\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe", |
| 74 | + "${env:ProgramFiles}\Microsoft Visual Studio\2022\Community\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe", |
| 75 | + "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe" |
| 76 | + ) |
| 77 | + foreach ($c in $candidates) { |
| 78 | + if (Test-Path $c) { $vsixPublisher = $c; break } |
| 79 | + } |
| 80 | + } |
| 81 | +
|
| 82 | + if (-not $vsixPublisher) { |
| 83 | + Write-Error "VsixPublisher.exe not found. Install Visual Studio SDK component." |
| 84 | + exit 1 |
| 85 | + } |
| 86 | +
|
| 87 | + Write-Host "Using VsixPublisher: $vsixPublisher" |
| 88 | + Write-Host "Publishing OffensiveVS360.vsix to Visual Studio Marketplace..." |
| 89 | +
|
| 90 | + & $vsixPublisher publish ` |
| 91 | + -payload "OffensiveVS360.vsix" ` |
| 92 | + -publishManifest "vsix_template\publishManifest.json" ` |
| 93 | + -personalAccessToken "$env:MARKETPLACE_PAT" ` |
| 94 | + -ignoreWarnings "VSIXValidatorWarning01,VSIXValidatorWarning02,VSIXValidatorWarning03" |
| 95 | +
|
| 96 | + if ($LASTEXITCODE -ne 0) { |
| 97 | + Write-Error "VsixPublisher failed with exit code $LASTEXITCODE" |
| 98 | + exit $LASTEXITCODE |
| 99 | + } |
| 100 | + Write-Host "Successfully published to Visual Studio Marketplace." |
0 commit comments