Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/actions/ps-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ runs:
Set-StrictMode -Version Latest
[void] (Import-Module InvokeBuild)
Invoke-Build -NugetApiKey ${{ env.PSGALLERY_API_KEY }} -Task Publish

- name: Publish build package to Github Release
shell: pwsh
run: |
Set-StrictMode -Version Latest
[void] (Import-Module InvokeBuild)
Invoke-Build -Task Package

- name: Upload build package to Github Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/package/*.nupkg
asset_name: ${{ github.event.repository.name }}-v${{ inputs.release-version }}.nupkg
asset_content_type: application/octet-stream
28 changes: 28 additions & 0 deletions PSScriptModule.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,34 @@ task Build Clean, {
Build-Module @requestParam
}

# Synopsis: Create a NuGet package for the module
task Package {
$packageOutputPath = Join-Path -Path $buildPath -ChildPath 'package'
if (!(Test-Path $packageOutputPath)) {
[void] (New-Item -Path $packageOutputPath -ItemType Directory -Force)
}

$requestParam = @{
Name = "$($moduleName)_local_feed"
SourceLocation = $packageOutputPath
PublishLocation = $packageOutputPath
InstallationPolicy = 'Trusted'
ErrorAction = 'Stop'
}
[void] (Register-PSRepository @requestParam)

$requestParam = @{
Path = (Join-Path -Path $buildPath -ChildPath "out/$moduleName")
Repository = "$($moduleName)_local_feed"
NuGetApiKey = 'ABC123'
ErrorAction = 'Stop'
}
[void] (Publish-Module @requestParam)

[void] (Unregister-PSRepository -Name "$($moduleName)_local_feed")

}

# Synopsis: Publish the module to PSGallery
task Publish -If ($NugetApiKey) {
$requestParam = @{
Expand Down