Skip to content

Commit 9ca3077

Browse files
committed
ci: fix powershell publishing job
1 parent 3fdb900 commit 9ca3077

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ jobs:
171171
tar -xvzf $WebAppArchive.FullName -C $TargetPath --strip-components=1
172172
173173
$PowerShellArchive = Get-ChildItem -Recurse -Filter "DevolutionsGateway-ps-*.zip" | Select-Object -First 1
174-
Expand-Archive -Path $PowerShellArchive -DestinationPath "$PkgDir"
174+
7z x "$PowerShellArchive" -o"$PkgDir" -aoa -y
175+
# Set-PSDebug -Off # Disable tracing before running the Expand-Archive command.
176+
# Expand-Archive -Path $PowerShellArchive -DestinationPath "$PkgDir"
175177
176178
- name: Build container
177179
id: build-container
@@ -280,10 +282,21 @@ jobs:
280282
- name: Publish PowerShell module
281283
shell: pwsh
282284
run: |
283-
Set-PSDebug -Trace 1
285+
# Publish-Module will parse the output of the dotnet nuget / dotnet pack commands.
286+
# Verify that we got everything.
287+
dotnet --list-sdks
288+
Write-Host
289+
dotnet nuget --help
290+
Write-Host
291+
dotnet pack --version
292+
Write-Host
284293
285294
$Archive = Get-ChildItem -Recurse -Filter "*-ps-*.zip" -File
286-
Expand-Archive -Path $Archive -DestinationPath 'PowerShell'
295+
Write-Host "Archive = $Archive"
296+
297+
# Expand-Archive -Path $Archive -DestinationPath './PowerShell'
298+
7z x "$Archive" -o"./PowerShell" -aoa -y
299+
Get-ChildItem -Path "./PowerShell" -Recurse
287300
288301
$PublishCmd = @('Publish-Module', '-Force', '-Path', (Join-Path PowerShell DevolutionsGateway), '-NugetApiKey', '${{ secrets.PS_GALLERY_NUGET_API_KEY }}')
289302
@@ -292,12 +305,11 @@ jobs:
292305
$PublishCmd += '-WhatIf'
293306
}
294307
$PublishCmd = $PublishCmd -Join ' '
295-
Write-Host $PublishCmd
308+
Write-Host "PublishCmd = $PublishCmd"
296309
297310
try {
298311
Invoke-Expression $PublishCmd
299-
}
300-
catch {
312+
} catch {
301313
if ($_.Exception.Message -ilike "*cannot be published as the current version*is already available in the repository*") {
302314
echo "::warning::PowerShell module not published; this version is already listed on PSGallery"
303315
} else {

0 commit comments

Comments
 (0)