File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,17 @@ jobs:
12
12
steps :
13
13
- name : " Checkout Repository"
14
14
15
- - name : " Change PowerShell Gallery Installation Policy"
15
+ - name : " Modify PowerShell Gallery Installation Policy"
16
+ id : " psgip"
16
17
run : |
17
- Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
18
+ Write-Host -Object "::set-output name=installationpolicy::$((Get-PSRepository -Name PSGallery).InstallationPolicy)"
19
+ Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
18
20
shell : " pwsh"
19
- - name : " Install PowerShellGet"
21
+ - name : " Setup PowerShellGet"
20
22
run : |
21
- Install-Module -AcceptLicense -Name PowerShellGet -Scope AllUsers -Verbose
23
+ if (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.5 -ErrorAction SilentlyContinue) {} else {
24
+ Install-Module -AcceptLicense -Name PowerShellGet -Scope AllUsers -Verbose
25
+ }
22
26
shell : " pwsh"
23
27
- name : " Update PowerShell Modules"
24
28
run : |
32
36
run : |
33
37
Publish-Module -Path .\hugoalh.GitHubActionsToolkit\ -NugetAPIKey '${{secrets.POWERSHELLGALLERY_TOKEN}}' -Verbose
34
38
shell : " pwsh"
39
+ - name : " Revert Modify PowerShell Gallery Installation Policy"
40
+ if : " ${{steps.psgip.outcome == 'success' && always()}}"
41
+ run : |
42
+ Set-PSRepository -Name PSGallery -InstallationPolicy '${{steps.psgip.outputs.installationpolicy}}'
43
+ shell : " pwsh"
You can’t perform that action at this time.
0 commit comments