Skip to content

Commit

Permalink
CI/CD pipeline (#5)
Browse files Browse the repository at this point in the history
Update azure-pipelines.yml for Azure Pipelines
  • Loading branch information
nicolonsky authored Aug 26, 2020
1 parent c7cbbbf commit 93a135a
Showing 1 changed file with 66 additions and 17 deletions.
83 changes: 66 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,71 @@
trigger:
- refs/tags/*

pool:
vmImage: windows-latest
variables:
- group: NuGetApiKey
- name: 'moduleName'
value: 'AzureADLicensing'

steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Install-Module InvokeBuild -Force
Install-Module PowerShellGet -Force
Install-Module ModuleBuilder -Force
Install-Module Pester -Force
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: 'AzureADLicensing-Module'
publishLocation: 'Container'
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)'

0 comments on commit 93a135a

Please sign in to comment.