-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
58 lines (53 loc) · 1.73 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
trigger:
branches:
include:
- main
paths:
exclude:
- docs/README.md
pr: none
pool:
vmImage: 'windows-latest'
steps:
- task: PowerShell@2
displayName: Update the Version Number
inputs:
targetType: 'inline'
script: |
$manifest = Import-PowerShellDataFile .\ADSNotebook.psd1
[version]$version = $Manifest.ModuleVersion
Write-Output "Old Version - $Version"
# Add one to the build of the version number
[version]$NewVersion = "{0}.{1}.{2}" -f $Version.Major, $Version.Minor, $ENV:BUILD_BUILDNUMBER
Write-Output "New Version - $NewVersion"
# Update the manifest file
try {
Write-Output "Updating the Module Version to $NewVersion"
$path = "$pwd\ADSNotebook.psd1"
(Get-Content .\ADSNotebook.psd1) -replace $version, $NewVersion | Set-Content .\ADSNotebook.psd1 -Encoding string
Write-Output "Updated the Module Version to $NewVersion"
}
catch {
Write-Error "Failed to update the Module Version - $_"
}
- task: PublishBuildArtifacts@1
displayName: Publish The Artifact
inputs:
PathtoPublish: '$(System.DefaultWorkingDirectory)'
ArtifactName: 'ADSNotebook'
publishLocation: 'Container'
- task: DownloadBuildArtifacts@0
displayName: Download the Artifact
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'ADSNotebook'
downloadPath: '$(System.DefaultWorkingDirectory)'
- task: PowerShell@2
displayName: Publish to the Gallery
inputs:
targetType: 'inline'
script: |
# Move files to a module folder
# Publish the Module to the PowerShell Gallery
Publish-Module -Path $(System.DefaultWorkingDirectory)\ADSNotebook -NuGetApiKey $(GALLERYPAT) -verbose