|
| 1 | +pool: |
| 2 | + vmImage: 'windows-2022' |
| 3 | + |
| 4 | +variables: |
| 5 | +- group: 'dotnet-config' |
| 6 | +- group: 'github-config' |
| 7 | + |
| 8 | +steps: |
| 9 | +- checkout: self |
| 10 | + persistCredentials: true |
| 11 | +- task: SSMClientToolsSetup@1 |
| 12 | + displayName: 'Setup DigiCert Tools' |
| 13 | + inputs: |
| 14 | + APIKey: '$(SM_API_KEY)' |
| 15 | +- task: DownloadSecureFile@1 |
| 16 | + displayName: 'Download Client Authentication Certificate' |
| 17 | + name: SM_CLIENT_CERT_FILE |
| 18 | + inputs: |
| 19 | + secureFile: ClientCert.p12 |
| 20 | +- task: PowerShell@2 |
| 21 | + displayName: 'Prepare Code Signing' |
| 22 | + inputs: |
| 23 | + targetType: 'inline' |
| 24 | + script: | |
| 25 | + $env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools' |
| 26 | + $env:SM_LOG_OUTPUT = 'console' |
| 27 | + smctl credentials save $(SM_API_KEY) $(SM_CLIENT_CERT_PASSWORD) |
| 28 | + smksp_cert_sync.exe |
| 29 | + failOnStderr: true |
| 30 | + pwsh: true |
| 31 | +- task: PowerShell@2 |
| 32 | + displayName: 'Get Version Number' |
| 33 | + inputs: |
| 34 | + filePath: 'azure-gitversion.ps1' |
| 35 | + failOnStderr: true |
| 36 | + pwsh: true |
| 37 | +- task: Assembly-Info-NetCore@2 |
| 38 | + displayName: 'Apply Assembly Infos' |
| 39 | + inputs: |
| 40 | + Path: '$(Build.SourcesDirectory)' |
| 41 | + FileNames: '**/*.csproj' |
| 42 | + InsertAttributes: true |
| 43 | + FileEncoding: 'auto' |
| 44 | + WriteBOM: false |
| 45 | + VersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)' |
| 46 | + FileVersionNumber: '$(MajorVersion).$(MinorVersion).$(PatchVersion).$(Build.BuildId)' |
| 47 | + InformationalVersion: '$(SemVersion)' |
| 48 | + LogLevel: 'verbose' |
| 49 | + FailOnWarning: false |
| 50 | +- task: DotNetCoreCLI@2 |
| 51 | + displayName: 'Restore' |
| 52 | + inputs: |
| 53 | + command: 'restore' |
| 54 | + projects: '*.sln' |
| 55 | + feedsToUse: 'select' |
| 56 | + vstsFeed: '340e7a34-33ea-4418-8b72-d55dcb74efa7/dd1a6c3c-4e29-44c2-a80d-9d6c7004ac57' |
| 57 | +- task: DotNetCoreCLI@2 |
| 58 | + displayName: 'Publish x64' |
| 59 | + inputs: |
| 60 | + command: 'publish' |
| 61 | + publishWebProjects: false |
| 62 | + projects: 'src/SqlDocs.App.csproj' |
| 63 | + arguments: '-c $(BuildConfiguration) -a x64 -o src/bin/Publish/win-x64 /p:Version=$(SemVersion)' |
| 64 | + zipAfterPublish: false |
| 65 | + modifyOutputPath: false |
| 66 | +- task: DotNetCoreCLI@2 |
| 67 | + displayName: 'Publish x86' |
| 68 | + inputs: |
| 69 | + command: 'publish' |
| 70 | + publishWebProjects: false |
| 71 | + projects: 'src/SqlDocs.App.csproj' |
| 72 | + arguments: '-c $(BuildConfiguration) -a x86 -o src/bin/Publish/win-x86 /p:Version=$(SemVersion)' |
| 73 | + zipAfterPublish: false |
| 74 | + modifyOutputPath: false |
| 75 | +- task: DotNetCoreCLI@2 |
| 76 | + displayName: 'Publish portable' |
| 77 | + inputs: |
| 78 | + command: 'publish' |
| 79 | + publishWebProjects: false |
| 80 | + projects: 'src/SqlDocs.App.csproj' |
| 81 | + arguments: '-c $(BuildConfiguration) -a x86 -o src/bin/Publish/portable /p:Version=$(SemVersion)' |
| 82 | + zipAfterPublish: false |
| 83 | + modifyOutputPath: false |
| 84 | +- task: PowerShell@2 |
| 85 | + displayName: 'Sign EXE files' |
| 86 | + inputs: |
| 87 | + targetType: 'inline' |
| 88 | + script: | |
| 89 | + $env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools' |
| 90 | + $env:SM_HOST = '$(SM_HOST)' |
| 91 | + $env:SM_CLIENT_CERT_FILE = '$(SM_CLIENT_CERT_FILE.secureFilePath)' |
| 92 | + $env:SM_LOG_OUTPUT = 'console' |
| 93 | + signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/win-x64/SqlDocs.exe |
| 94 | + signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/win-x86/SqlDocs.exe |
| 95 | + signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.SourcesDirectory)/src/bin/Publish/portable/SqlDocs.exe |
| 96 | + failOnStderr: true |
| 97 | + pwsh: true |
| 98 | +- task: DotNetCoreCLI@2 |
| 99 | + displayName: 'Build MSI Setup x64' |
| 100 | + inputs: |
| 101 | + command: 'build' |
| 102 | + projects: 'setup/SqlDocs.Setup.wixproj' |
| 103 | + arguments: '-c $(BuildConfiguration) -p:Platform=x64 -o $(Build.ArtifactStagingDirectory)' |
| 104 | +- task: DotNetCoreCLI@2 |
| 105 | + displayName: 'Build MSI Setup x86' |
| 106 | + inputs: |
| 107 | + command: 'build' |
| 108 | + projects: 'setup/SqlDocs.Setup.wixproj' |
| 109 | + arguments: '-c $(BuildConfiguration) -p:Platform=x86 -o $(Build.ArtifactStagingDirectory)' |
| 110 | +- task: ArchiveFiles@2 |
| 111 | + displayName: 'Create Zip for portable' |
| 112 | + inputs: |
| 113 | + rootFolderOrFile: '$(Build.SourcesDirectory)/src/bin/Publish/portable/' |
| 114 | + includeRootFolder: false |
| 115 | + archiveType: 'zip' |
| 116 | + archiveFile: '$(Build.ArtifactStagingDirectory)/sqldocs-portable.zip' |
| 117 | + replaceExistingArchive: true |
| 118 | +- task: PowerShell@2 |
| 119 | + displayName: 'Sign MSI files' |
| 120 | + inputs: |
| 121 | + targetType: 'inline' |
| 122 | + script: | |
| 123 | + $env:PATH += ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64;C:\Program Files\DigiCert\DigiCert Keylocker Tools' |
| 124 | + $env:SM_HOST = '$(SM_HOST)' |
| 125 | + $env:SM_CLIENT_CERT_FILE = '$(SM_CLIENT_CERT_FILE.secureFilePath)' |
| 126 | + $env:SM_LOG_OUTPUT = 'console' |
| 127 | + signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.ArtifactStagingDirectory)/sqldocs-x64.msi |
| 128 | + signtool.exe sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /sha1 $(SM_CERT_FINGERPRINT) $(Build.ArtifactStagingDirectory)/sqldocs-x86.msi |
| 129 | + failOnStderr: true |
| 130 | + pwsh: true |
| 131 | +- task: PowerShell@2 |
| 132 | + displayName: 'Push code to GitHub' |
| 133 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) |
| 134 | + inputs: |
| 135 | + targetType: 'inline' |
| 136 | + script: | |
| 137 | + git remote add github https://$(PAT)@github.com/openpotato/sqldocs.git |
| 138 | + git fetch github |
| 139 | + git checkout . |
| 140 | + git push github HEAD:main |
| 141 | + git push --tags github HEAD:main |
| 142 | + pwsh: true |
| 143 | +- task: GitHubRelease@1 |
| 144 | + displayName: 'Create GitHub Release' |
| 145 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) |
| 146 | + inputs: |
| 147 | + gitHubConnection: 'stuebersystems' |
| 148 | + repositoryName: 'openpotato/sqldocs' |
| 149 | + action: 'create' |
| 150 | + target: '$(Build.SourceVersion)' |
| 151 | + tagSource: 'gitTag' |
| 152 | + title: '$(SemVersion) Release of SqlDocs' |
| 153 | + addChangeLog: false |
0 commit comments