99 branches : [ "main" ]
1010 workflow_dispatch :
1111 inputs :
12- release :
12+ publishVsix :
1313 description : ' Publish extension to the Visual Studio Marketplace?'
1414 required : true
1515 default : ' false'
16+ publishNupkg :
17+ description : ' Publish NuGet package to nuget.org?'
18+ required : true
19+ default : ' false'
1620
1721jobs :
1822
5054 echo "SEM_VERSION=$majorVersion.$minorVersion.$buildVersion" >> $env:GITHUB_ENV
5155
5256 - name : Set version number for pre-release
53- if : ${{ github.event.inputs.release == '' || github.event.inputs.release == 'false' }}
57+ if : ${{ github.event.inputs.publishNupkg == '' || github.event.inputs.publishNupkg == 'false' }}
5458 run : |
5559 echo "SEM_VERSION=${{ env.SEM_VERSION }}-build-${{ github.RUN_NUMBER }}" >> $env:GITHUB_ENV
5660
@@ -149,7 +153,7 @@ jobs:
149153 if-no-files-found : error
150154
151155 - name : Publish GitHub Release
152- if : ${{ matrix.Configuration == 'Release' && github.event.inputs.release == 'true' }}
156+ if : ${{ matrix.Configuration == 'Release' && ( github.event.inputs.publishNupkg == 'true' || github.event.inputs.publishVsix == 'true') }}
153157 uses : softprops/action-gh-release@v2.0.8
154158 with :
155159 name : v${{ env.VERSION }}
@@ -163,11 +167,11 @@ jobs:
163167 ./src/PackageReferenceVersionToAttributeTool/bin/${{matrix.Configuration}}/PackageReferenceVersionToAttribute.Tool.${{ env.SEM_VERSION }}.nupkg
164168
165169 - name : Publish NuGet Package
166- if : ${{ matrix.Configuration == 'Release' && github.event_name != 'pull_request' }}
170+ if : ${{ matrix.Configuration == 'Release' && github.event_name != 'pull_request' && github.event.inputs.publishNupkg == 'true' }}
167171 run : dotnet nuget push .\src\PackageReferenceVersionToAttributeTool\bin\${{matrix.Configuration}}\PackageReferenceVersionToAttribute.Tool.${{ env.SEM_VERSION }}.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
168172
169173 - name : Publish to Open VSIX
170- if : ${{ matrix.Configuration == 'Release' && github.event.inputs.release == 'true' }}
174+ if : ${{ matrix.Configuration == 'Release' && github.event_name != 'pull_request' && github. event.inputs.publishNupkg == 'true' }}
171175 run : |
172176 [Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null
173177 $vsixFile = ".\src\PackageReferenceVersionToAttributeExtension\bin\${{matrix.Configuration}}\PackageReferenceVersionToAttributeExtension.vsix"
@@ -185,7 +189,7 @@ jobs:
185189 }
186190
187191 - name : Publish extension to the Visual Studio Marketplace
188- if : ${{ matrix.Configuration == 'Release' && github.event.inputs.release == 'true' }}
192+ if : ${{ matrix.Configuration == 'Release' && github.event.inputs.publishVsix == 'true' }}
189193 uses : cezarypiatek/VsixPublisherAction@1.1
190194 with :
191195 extension-file : .\src\PackageReferenceVersionToAttributeExtension\bin\${{matrix.Configuration}}\PackageReferenceVersionToAttributeExtension.vsix
0 commit comments