-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
73 lines (68 loc) · 2.32 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
# AzureADLicensing PowerShell Module Build Pipeline
trigger:
- refs/tags/*
variables:
- group: NuGetApiKey
- name: 'moduleName'
value: 'AzureADLicensing'
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: 'windows-latest'
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Install-Module InvokeBuild -Force
Install-Module PowerShellGet -Force
Install-Module ModuleBuilder -Force
Install-Module Pester -Force
Invoke-Build
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'bin'
ArtifactName: '$(moduleName)-Module'
publishLocation: 'Container'
- stage: Deploy
jobs:
- deployment: 'Deploy'
displayName: 'Publish to PSGallery and GitHub'
pool:
vmImage: 'windows-latest'
environment: 'production'
strategy:
runOnce:
deploy:
steps:
- checkout: none
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: '$(moduleName)-Module'
downloadPath: '$(System.ArtifactsDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.ArtifactsDirectory)/$(moduleName)-Module/$(moduleName)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(moduleName).zip'
replaceExistingArchive: true
verbose: true
- task: GitHubRelease@1
displayName: 'Create GitHub release'
inputs:
gitHubConnection: GitHub
tagPattern: 'v*.*'
assets: '*.zip'
- task: PowerShell@2
displayName: 'Publish to PowerShell Gallery'
inputs:
targetType: 'inline'
script: |
Install-Module Az.Accounts -Force
Publish-Module -Path ".\*\" -NuGetApiKey $(NuGetApiKey)
workingDirectory: '$(System.ArtifactsDirectory)/$(moduleName)-Module/$(moduleName)'