generated from brianary/PSModuleTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (54 loc) · 1.89 KB
/
dotnetcore.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
name: .NET Core
on: push
jobs:
ci-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet publish -t:test
ci-windows:
runs-on: windows-latest
env:
gallerykey: ${{ secrets.gallerykey }}
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 2
- name: Module update check
id: is_module_update_test
shell: pwsh
run: |
Write-Host "::set-output name=is_module_update::$(@(git diff --name-only HEAD~ HEAD -- "$(Resolve-Path .\src\*\*.psd1)").Count -gt 0)"
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet publish -t:test
- name: Publish
if: success() && env.gallerykey && steps.is_module_update_test.outputs.is_module_update == 'True'
shell: pwsh
run: |
dotnet publish -c Release
$MSBuildProjectName = [io.path]::GetFileNameWithoutExtension("$(Resolve-Path ./src/*/*.fsproj)")
$env:PSModulePath -split ';' |
ForEach-Object {"$_/$MSBuildProjectName"} |
Where-Object {Test-Path $_ -Type Container} |
Remove-Item -Recurse -Force
Push-Location ./src/*/bin/Release/*/publish
Import-LocalizedData Module -FileName $MSBuildProjectName -BaseDirectory "$PWD"
$Version = $Module.ModuleVersion
$InstallPath = "$env:UserProfile/Documents/PowerShell/Modules/$MSBuildProjectName/$Version"
if(!(Test-Path $InstallPath -Type Container)) {mkdir $InstallPath}
Copy-Item * -Destination $InstallPath
Pop-Location
Publish-Module -Name $MSBuildProjectName -NuGetApiKey $env:gallerykey