-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (46 loc) · 1.89 KB
/
deploy.yml
File metadata and controls
56 lines (46 loc) · 1.89 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
name: Deploy PowerShell Gallery
on:
release:
types: [ published ]
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: MagicTooltips
PS_GALLERY_KEY: ${{secrets.PS_GALLERY_KEY}}
jobs:
deploy:
if: github.event_name == 'release'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.x
- name: Publish Module to PowerShell Gallery
run: |
$VERSION=($env:GITHUB_REF -split "/" | select -skip 2).TrimStart("v")
echo Version: $VERSION
$distFolder = "./dist/MagicTooltips/"
if (Test-Path $distFolder) {
Remove-Item $distFolder -Recurse -Force
}
New-Item $distFolder -ItemType "directory"
Copy-Item -Path "./src/MagicTooltips.psd1" -Destination $distFolder
Copy-Item -Path "./src/MagicTooltips.psm1" -Destination $distFolder
dotnet build -c Release -p:Version=$VERSION -o "$($distFolder)lib/" ./src/$env:PROJECT_NAME/$env:PROJECT_NAME.csproj
$manifestPath = Resolve-Path -Path "$($distFolder)$env:PROJECT_NAME.psd1"
Write-Host "Manifest Path: $manifestPath"
Update-ModuleManifest -ReleaseNotes $releaseNotes -Path $manifestPath.Path -ModuleVersion $VERSION #-Verbose
$moduleFilePath = Resolve-Path -Path "$($distFolder)$env:PROJECT_NAME.psm1"
Write-Host "Module File Path: $moduleFilePath"
try{
Publish-Module -Path $distFolder -NuGetApiKey $env:PS_GALLERY_KEY -ErrorAction Stop -Force
Write-Host "v$($VERSION) has been Published to the PowerShell Gallery!"
}
catch {
throw $_
}