-
Notifications
You must be signed in to change notification settings - Fork 5
37 lines (28 loc) · 1.18 KB
/
PublishNugetPackage.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
name: Publish PowerShell Module
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update module version
shell: pwsh
run: |
$modulePath = "./PowerDataOps.psd1";
$moduleContent = [IO.File]::ReadAllText($modulePath);
$module = [PsCustomObject] (Import-PowerShellDataFile $modulePath);
$currentVersion = [version] $module.ModuleVersion;
$newVersion = [version]::new($currentVersion.Major, $currentVersion.Minor, $currentVersion.Build, $currentVersion.Revision + 1);
Write-Host "New Module Version = $($newVersion.ToString())";
$moduleContent = $moduleContent.Replace($currentVersion.ToString(), $newVersion.ToString());
$moduleContent | Set-Content $modulePath;
- name: Publish to PSGallery
shell: pwsh
run: |
Publish-Module -Path "./" -NuGetApiKey "${{ secrets.PS_GALLERY_KEY }}" -SkipAutomaticTags -Verbose
env:
PS_GALLERY_KEY: ${{ secrets.PS_GALLERY_KEY }}