-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathazure-pipelines.yml
101 lines (94 loc) · 3.39 KB
/
azure-pipelines.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
96
97
98
99
100
101
trigger:
branches:
include:
- master
paths:
include:
- /Intune.USB.Creator/ReleaseNotes.txt
exclude:
- /.gitignore
- /readme.md
- /.tests
pr: none
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: 'vs2017-win2016'
steps:
- task: PowerShell@2
displayName: Pre-Build
inputs:
targetType: 'inline'
script: |
Install-Module -Name Pester -MaximumVersion 4.10.1 -Verbose -Scope CurrentUser -SkipPublisherCheck -Force
Install-Module WindowsAutoPilotIntune -Scope CurrentUser -Force
Install-Module Microsoft.Graph.Intune -Scope CurrentUser -Force
Install-Module TestJsonSchema -Scope CurrentUser -SkipPublisherCheck -ErrorAction SilentlyContinue -Force
Install-Module PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck -ErrorAction SilentlyContinue -Force
pwsh: true
- task: PowerShell@2
displayName: Build
inputs:
filePath: './build.ps1'
arguments: '-modulePath $(modulePath)'
pwsh: true
- task: PowerShell@2
displayName: 'Code Quality Test'
inputs:
filePath: './tests/codecheck.ps1'
pwsh: true
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: 'pester.codecheck.test.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/.tests'
failTaskOnFailedTests: true
testRunTitle: 'Code Quality Test'
- task: CopyFiles@2
inputs:
SourceFolder: './bin/release'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
CleanTargetFolder: true
- task: PublishPipelineArtifact@1
displayName: Publish Artifact
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'release'
publishLocation: 'pipeline'
- stage: Deploy
jobs:
- deployment: 'Deploy'
displayName: 'Publish to PSGallery'
pool:
vmImage: 'vs2017-win2016'
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
try {
$modules = @(
"WindowsAutoPilotIntune"
"Microsoft.Graph.Intune"
)
foreach ($m in $modules) {
write-host "Installing module: $m.."
Install-Module $m -Scope CurrentUser -Force
}
write-host "Publishing module from: $env:Pipeline_Workspace\release\$env:MODULENAME"
Publish-Module -Path "$env:Pipeline_Workspace\release\$env:MODULENAME" -NuGetApiKey $env:APIKEY
}
catch {
write-warning $_
}
pwsh: true
env:
APIKEY: $(apiKey)