-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (38 loc) · 1.44 KB
/
PSGallery-Publish.yaml
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
name: Publish PowerShell Module
on:
push:
branches: [main]
jobs:
PSGallery-Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build and publish
id: build
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: |
Copy-Item 'Modules/ibPS' '/home/runner/.local/share/powershell/Modules/' -Recurse
$Manifest = Test-ModuleManifest 'Modules/ibPS/ibPS.psd1'
if ($($Manifest.Version) -gt $(Find-Module ibPS).Version) {
Write-Host "Publishing v$($Manifest.Version.ToString()).."
Publish-Module -Name "ibPS" -NuGetApiKey $env:NUGET_KEY -SkipAutomaticTags -Verbose
} else {
Write-Host "Version number is the same, skipping publishing.."
}
$Version = "v$($Manifest.Version.ToString())"
Write-Output "Version=$($Version)" | Out-File -FilePath $ENV:GITHUB_ENV -Encoding utf8 -Append
Write-Output "ReleaseNotes=$($Manifest.ReleaseNotes)" | Out-File -FilePath $ENV:GITHUB_ENV -Encoding utf8 -Append
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GIT_ACTIONS }}
with:
tag_name: ${{ env.Version }}
release_name: Release ${{ env.Version }}
body: ${{ env.ReleaseNotes }}
draft: true
prerelease: false