release v1.2.0 and vl-0.3.0 #5
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-VL-package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'vl-*' # trigger on tags like vl-0.1.0-preview or vl-0.2.0 | |
| paths: | |
| - "VL.MCP.HDE/VL.MCP.HDE.nuspec" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version (e.g. 0.1.0-preview). Leave empty to use version in nuspec." | |
| required: false | |
| default: "" | |
| permissions: | |
| id-token: write # required for NuGet trusted publishing (OIDC) | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.x' | |
| - name: Setup NuGet | |
| uses: nuget/setup-nuget@v2 | |
| # Bump nuspec version from tag (vl-0.1.0-preview → 0.1.0-preview) | |
| - name: Set version from tag | |
| if: ${{ github.event_name == 'push' }} | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ github.ref_name }}" # e.g. vl-0.1.0-preview | |
| $version = $tag.Substring(3) # strip "vl-" | |
| $nuspec = "VL.MCP.HDE\VL.MCP.HDE.nuspec" | |
| $xml = [xml](Get-Content $nuspec) | |
| $xml.package.metadata.version = $version | |
| $xml.Save($nuspec) | |
| Write-Host "Version set to $version" | |
| - name: Set version from input | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }} | |
| shell: pwsh | |
| run: | | |
| $nuspec = "VL.MCP.HDE\VL.MCP.HDE.nuspec" | |
| $xml = [xml](Get-Content $nuspec) | |
| $xml.package.metadata.version = "${{ inputs.version }}" | |
| $xml.Save($nuspec) | |
| Write-Host "Version set to ${{ inputs.version }}" | |
| - name: Build VL.MCP.HDE | |
| run: dotnet build VL.MCP.HDE\src\VL.MCP.Bridge.csproj --configuration Release | |
| - name: Pack with nuspec | |
| run: nuget pack VL.MCP.HDE\VL.MCP.HDE.nuspec -OutputDirectory nupkg-vl | |
| - name: Show package | |
| shell: pwsh | |
| run: | | |
| $pkg = Get-ChildItem nupkg-vl\*.nupkg | Select-Object -First 1 | |
| Write-Host "Package: $($pkg.Name) ($([math]::Round($pkg.Length/1MB,1)) MB)" | |
| # NuGet Trusted Publishing — exchanges GitHub OIDC token for a short-lived API key. | |
| # Requires "Trusted Publishing" policy configured on nuget.org for this repo + workflow. | |
| # See: https://learn.microsoft.com/nuget/nuget-org/trusted-publishing | |
| - name: NuGet login (OIDC) | |
| uses: NuGet/login@v1 | |
| id: nuget-login | |
| with: | |
| user: digital.wannabe | |
| - name: Push to NuGet.org | |
| shell: pwsh | |
| run: | | |
| $nupkg = Get-ChildItem nupkg-vl\*.nupkg | Select-Object -First 1 -ExpandProperty FullName | |
| dotnet nuget push $nupkg ` | |
| --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} ` | |
| --source https://api.nuget.org/v3/index.json ` | |
| --skip-duplicate |