-
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (49 loc) · 1.83 KB
/
Copy pathPoShGallery-Publish.yml
File metadata and controls
62 lines (49 loc) · 1.83 KB
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
name: Publish to PowerShell Gallery
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7.0.0
- name: Validate module manifest
shell: pwsh
run: |
$psd1Path = Join-Path $PWD 'Nebula.Core.psd1'
Test-ModuleManifest -Path $psd1Path -Verbose
- name: Prepare module package
shell: pwsh
run: |
$outDir = Join-Path $PWD 'build'
$moduleName = 'Nebula.Core'
$moduleDir = Join-Path $outDir $moduleName
if (Test-Path $outDir) { Remove-Item -Recurse -Force $outDir }
New-Item -ItemType Directory -Path $moduleDir -Force | Out-Null
$includeFiles = @(
"$moduleName.psd1",
"$moduleName.psm1",
"README.md"
)
foreach ($file in $includeFiles) {
if (Test-Path $file) { Copy-Item -Path $file -Destination $moduleDir -Force }
}
$foldersToInclude = @("Formats", "Private", "Public")
foreach ($folder in $foldersToInclude) {
if (Test-Path $folder) { Copy-Item -Path $folder -Destination $moduleDir -Recurse -Force }
}
- name: Publish module to PowerShell Gallery
shell: pwsh
run: |
$modulePath = Join-Path $PWD 'build' | Join-Path -ChildPath 'Nebula.Core'
if (-not (Get-PSRepository -Name 'PSGallery' -ErrorAction SilentlyContinue)) {
Register-PSRepository -Name 'PSGallery' -SourceLocation 'https://www.powershellgallery.com/api/v2' -InstallationPolicy Trusted
}
Publish-Module -Path $modulePath `
-NuGetApiKey "${{ secrets.NUGET_API_KEY }}" `
-Verbose