package-vsix #8
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: package-vsix | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "VSIX target (defaults to win32-x64)" | |
| type: choice | |
| required: true | |
| default: win32-x64 | |
| options: | |
| - win32-x64 | |
| - linux-x64 | |
| - darwin-x64 | |
| - darwin-arm64 | |
| netcoredbg_url: | |
| description: "Direct download URL for netcoredbg binary (.exe or archive)" | |
| type: string | |
| required: true | |
| netcoredbg_license_url: | |
| description: "Optional download URL for netcoredbg LICENSE" | |
| type: string | |
| required: false | |
| jobs: | |
| package: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: src/extension/package-lock.json | |
| - name: Install extension dependencies | |
| working-directory: src/extension | |
| run: npm ci | |
| - name: Download netcoredbg | |
| id: netcoredbg | |
| shell: pwsh | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $downloadDir = Join-Path $env:RUNNER_TEMP 'netcoredbg' | |
| New-Item -ItemType Directory -Force -Path $downloadDir | Out-Null | |
| $assetName = Split-Path -Leaf '${{ inputs.netcoredbg_url }}' | |
| if (-not $assetName) { | |
| $assetName = 'netcoredbg-asset' | |
| } | |
| $asset = Join-Path $downloadDir $assetName | |
| Invoke-WebRequest -Uri '${{ inputs.netcoredbg_url }}' -OutFile $asset | |
| $extractDir = Join-Path $downloadDir 'extract' | |
| if ($asset -like '*.zip') { | |
| Expand-Archive -Path $asset -DestinationPath $extractDir -Force | |
| } elseif ($asset -like '*.tar.gz' -or $asset -like '*.tgz') { | |
| New-Item -ItemType Directory -Force -Path $extractDir | Out-Null | |
| tar -xf $asset -C $extractDir | |
| } else { | |
| $extractDir = $downloadDir | |
| } | |
| $candidates = Get-ChildItem -Path $extractDir -Recurse -File -ErrorAction SilentlyContinue | | |
| Where-Object { $_.Name -eq 'netcoredbg.exe' -or $_.Name -eq 'netcoredbg' } | |
| $exe = $candidates | Select-Object -First 1 | |
| if (-not $exe) { | |
| throw "netcoredbg executable not found in downloaded asset." | |
| } | |
| "NETCOREDBG_PATH=$($exe.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| if ('${{ inputs.netcoredbg_license_url }}') { | |
| $licensePath = Join-Path $downloadDir 'LICENSE' | |
| Invoke-WebRequest -Uri '${{ inputs.netcoredbg_license_url }}' -OutFile $licensePath | |
| "NETCOREDBG_LICENSE=$licensePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| } | |
| - name: Package VSIX | |
| working-directory: src/extension | |
| shell: pwsh | |
| env: | |
| NETCOREDBG_PATH: ${{ steps.netcoredbg.outputs.NETCOREDBG_PATH }} | |
| NETCOREDBG_LICENSE: ${{ steps.netcoredbg.outputs.NETCOREDBG_LICENSE }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| npm run bundle-server | |
| npm run bundle-debugger | |
| npm run package | |
| $vsceArgs = @("package", "--target", "${{ inputs.target }}", "--out", "vbnet-language-support-${{ inputs.target }}.vsix") | |
| if ('${{ inputs.pre_release }}' -eq 'true') { | |
| $vsceArgs += "--pre-release" | |
| } | |
| npx vsce @vsceArgs | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vbnet-language-support-${{ inputs.target }}.vsix | |
| path: src/extension/vbnet-language-support-${{ inputs.target }}.vsix |