-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (87 loc) · 3.33 KB
/
publish.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build / publish
on:
push:
pull_request:
types: [opened, reopened]
release:
types: [published]
jobs:
main:
strategy:
matrix:
include:
- os: ubuntu-latest
powershell: false
publish: false
- os: windows-latest
powershell: true
publish: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build
shell: pwsh
run: |
if ($env:GITHUB_REF -like "refs/tags/*") {
$versionnumber = $env:GITHUB_REF -replace "refs/tags/", ""
$manifestpath = "Rnwood.Dataverse.Data.PowerShell//Rnwood.Dataverse.Data.PowerShell.psd1"
(get-content -raw -encoding UTF8 $manifestpath ) -replace "ModuleVersion ?=.*", "ModuleVersion = `"$versionnumber`"" | set-content -encoding UTF8 $manifestpath
}
dotnet build -c Release ./Rnwood.Dataverse.Data.PowerShell/Rnwood.Dataverse.Data.PowerShell.csproj
if (test-path out/Rnwood.Dataverse.Data.PowerShell) {
remove-item -force -recurse out/Rnwood.Dataverse.Data.PowerShell
}
copy-item -recurse Rnwood.Dataverse.Data.PowerShell\bin\Release\netstandard2.0 out/Rnwood.Dataverse.Data.PowerShell
- name: Test - pwsh
shell: pwsh
run: |
$env:TESTMODULEPATH=(resolve-path "out/Rnwood.Dataverse.Data.PowerShell")
Install-Module -force Pester
Invoke-Pester -output detailed -path tests
if ($LASTEXITCODE -ne 0) {
throw "Tests failed"
}
- if: ${{ matrix.powershell }}
name: Test - powershell
shell: powershell
run: |
$env:TESTMODULEPATH=(resolve-path "out/Rnwood.Dataverse.Data.PowerShell")
Install-Module -force Pester
Invoke-Pester -output detailed -path tests
if ($LASTEXITCODE -ne 0) {
throw "Tests failed"
}
- name: E2E Test - pwsh
shell: pwsh
env:
E2ETESTS_URL: ${{ vars.E2ETESTS_URL }}
E2ETESTS_CLIENTID: ${{ vars.E2ETESTS_CLIENTID }}
E2ETESTS_CLIENTSECRET: ${{ secrets.E2ETESTS_CLIENTSECRET }}
run: |
$env:TESTMODULEPATH=(resolve-path "out/Rnwood.Dataverse.Data.PowerShell")
Install-Module -force Pester
Invoke-Pester -output detailed -path e2e-tests
if ($LASTEXITCODE -ne 0) {
throw "Tests failed"
}
- if: ${{matrix.powershell}}
name: E2E Test - powershell
shell: powershell
env:
E2ETESTS_URL: ${{ vars.E2ETESTS_URL }}
E2ETESTS_CLIENTID: ${{ vars.E2ETESTS_CLIENTID }}
E2ETESTS_CLIENTSECRET: ${{ secrets.E2ETESTS_CLIENTSECRET }}
run: |
$env:TESTMODULEPATH=(resolve-path "out/Rnwood.Dataverse.Data.PowerShell")
Install-Module -force Pester
Invoke-Pester -output detailed -path e2e-tests
if ($LASTEXITCODE -ne 0) {
throw "Tests failed"
}
- if: ${{ matrix.publish && github.event_name == 'release' && github.event.action == 'published' }}
name: Publish
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: |
Publish-Module -Path out/Rnwood.Dataverse.Data.PowerShell -NuGetApiKey $env:NUGET_KEY -Verbose