-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
74 lines (72 loc) · 2.67 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
pool:
vmImage: 'windows-2019'
variables:
- group: 'powershell-config'
- group: 'github-config'
steps:
- checkout: self
persistCredentials: true
- task: DownloadSecureFile@1
displayName: 'Download Code Signing certificate'
name: Certificate
inputs:
secureFile: cert.pfx
- task: PowerShell@2
displayName: 'Get Version Number'
inputs:
filePath: 'azure-gitversion.ps1'
failOnStderr: true
pwsh: true
- task: PowerShell@2
displayName: 'Update Module Version'
inputs:
targetType: 'inline'
script: |
Update-ModuleManifest -Path $(Build.SourcesDirectory)/src/PsDaVinci/PsDaVinci.psd1 -ModuleVersion $(MajorVersion).$(MinorVersion).$(PatchVersion)
pwsh: true
- task: PowerShell@2
displayName: 'Sign Module'
inputs:
targetType: 'inline'
script: |
$pswd = ConvertTo-SecureString $(CertificatePassword) -AsPlainText -Force
$cert = Get-PfxCertificate -FilePath $(Certificate.secureFilePath) -Password $pswd
Set-AuthenticodeSignature -FilePath $(Build.SourcesDirectory)/src/PsDaVinci/PsDaVinci.psm1 -Certificate $cert -TimestampServer http://timestamp.digicert.com
Set-AuthenticodeSignature -FilePath $(Build.SourcesDirectory)/src/PsDaVinci/PsDaVinci.psd1 -Certificate $cert -TimestampServer http://timestamp.digicert.com
pwsh: true
- task: PowerShell@2
displayName: 'Create Catalog'
inputs:
targetType: 'inline'
script: |
New-FileCatalog -Path $(Build.SourcesDirectory)/src/PsDaVinci -CatalogFilePath $(Build.SourcesDirectory)/src/PsDaVinci/PsDaVinci.cat -CatalogVersion 2.0
pwsh: true
- task: PowerShell@2
displayName: 'Sign Catalog'
inputs:
targetType: 'inline'
script: |
$pswd = ConvertTo-SecureString $(CertificatePassword) -AsPlainText -Force
$cert = Get-PfxCertificate -FilePath $(Certificate.secureFilePath) -Password $pswd
Set-AuthenticodeSignature $(Build.SourcesDirectory)/src/PsDaVinci/PsDaVinci.cat -Certificate $cert -TimestampServer http://timestamp.digicert.com
pwsh: true
- task: PowerShell@2
displayName: 'Publish to PS Gallery'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
Publish-Module -Path $(Build.SourcesDirectory)/src/PsDaVinci -NuGetApiKey $(NuGetApiKey)
pwsh: true
- task: PowerShell@2
displayName: 'Push to GitHub'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
git remote add github https://$(PAT)@github.com/stuebersystems/psdavinci.git
git fetch github
git checkout .
git push github HEAD:main
git push --tags github HEAD:main
pwsh: true