File tree Expand file tree Collapse file tree
.github/actions/ps-release Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 Set-StrictMode -Version Latest
6767 [void] (Import-Module InvokeBuild)
6868 Invoke-Build -NugetApiKey ${{ env.PSGALLERY_API_KEY }} -Task Publish
69+
70+ - name : Publish build package to Github Release
71+ shell : pwsh
72+ run : |
73+ Set-StrictMode -Version Latest
74+ [void] (Import-Module InvokeBuild)
75+ Invoke-Build -Task Package
76+
77+ - name : Upload build package to Github Release
78+ uses : actions/upload-release-asset@v1
79+ with :
80+ upload_url : ${{ steps.create_release.outputs.upload_url }}
81+ asset_path : ./build/package/*.nupkg
82+ asset_name : ${{ github.event.repository.name }}-v${{ inputs.release-version }}.nupkg
83+ asset_content_type : application/octet-stream
Original file line number Diff line number Diff line change @@ -215,6 +215,34 @@ task Build Clean, {
215215 Build-Module @requestParam
216216}
217217
218+ # Synopsis: Create a NuGet package for the module
219+ task Package {
220+ $packageOutputPath = Join-Path - Path $buildPath - ChildPath ' package'
221+ if (! (Test-Path $packageOutputPath )) {
222+ [void ] (New-Item - Path $packageOutputPath - ItemType Directory - Force)
223+ }
224+
225+ $requestParam = @ {
226+ Name = " $ ( $moduleName ) _local_feed"
227+ SourceLocation = $packageOutputPath
228+ PublishLocation = $packageOutputPath
229+ InstallationPolicy = ' Trusted'
230+ ErrorAction = ' Stop'
231+ }
232+ [void ] (Register-PSRepository @requestParam )
233+
234+ $requestParam = @ {
235+ Path = (Join-Path - Path $buildPath - ChildPath " out/$moduleName " )
236+ Repository = " $ ( $moduleName ) _local_feed"
237+ NuGetApiKey = ' ABC123'
238+ ErrorAction = ' Stop'
239+ }
240+ [void ] (Publish-Module @requestParam )
241+
242+ [void ] (Unregister-PSRepository - Name " $ ( $moduleName ) _local_feed" )
243+
244+ }
245+
218246# Synopsis: Publish the module to PSGallery
219247task Publish - If ($NugetApiKey ) {
220248 $requestParam = @ {
You can’t perform that action at this time.
0 commit comments