-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaction.yml
95 lines (95 loc) · 3.25 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Publish PowerShell
description: |
Publish a PowerShell module or script to GitHub Packages, the PowerShell Gallery, or a NuGet repository via PowerShellGet 3.
branding:
icon: book
color: blue
inputs:
token:
description: |
Token to authenticate.
required: true
target:
description: |
Set to `packages` for GitHub Packages, `gallery` for the PowerShell Gallery, or `nuget` for a NuGet repository.
required: true
path:
description: |
Path to publish relative to the root of the project. Can either be a .psd1 file, a .ps1 file, or a directory. If a directory, the action will search for a .psd1 file in the root. If none are found, it will then
search for a .ps1 file in the root.
required: true
nugetUrl:
description: |
Url to use with NuGet target. Should be a NuGet v2 or v3 endpoint.
required: false
runs:
using: composite
steps:
- name: Validate Inputs
run: . "$env:GITHUB_ACTION_PATH\src\steps\1_validate.ps1"
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh
- name: Prepare to Publish
run: . "$env:GITHUB_ACTION_PATH\src\steps\2_prepare.ps1"
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh
- name: Publish to GitHub Packages
run: |
if ($env:INPUT_TARGET -eq "packages") {
. "$env:GITHUB_ACTION_PATH\src\steps\3_publish_to_packages.ps1"
} else {
Write-Host "Skipping as GitHubPackages target was not selected."
}
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh
- name: Publish to NuGet Repository
run: |
if ($env:INPUT_TARGET -eq "nuget") {
. "$env:GITHUB_ACTION_PATH\src\steps\4_publish_to_nuget.ps1"
} else {
Write-Host "Skipping as NuGet target was not selected."
}
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh
- name: Publish to PowerShell Gallery
run: |
if ($env:INPUT_TARGET -eq "gallery") {
. "$env:GITHUB_ACTION_PATH\src\steps\5_publish_to_gallery.ps1"
} else {
Write-Host "Skipping as Gallery target was not selected."
}
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh
- name: Cleanup
run: |
if ($env:UNINSTALL_STRING) {
. "$env:GITHUB_ACTION_PATH\src\steps\6_cleanup.ps1"
} else {
Write-Host "Skipping as there is nothing to clean up."
}
env:
INPUT_TOKEN: ${{ inputs.token }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_PATH: ${{ inputs.path }}
INPUT_NUGETURL: ${{ inputs.nugetUrl }}
shell: pwsh