Skip to content

Commit 32640a2

Browse files
authored
Create a pipeline for official builds (#10)
* new pipeline for build and sign * fix job name * fix typo * no CI build * Add sign and zip * fix indent * fix spacing * exclude codesign file from release * add draft github release step * remove github release
1 parent 76685e9 commit 32640a2

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
steps:
2+
- task: GoTool@0
3+
inputs:
4+
version: '1.16.5'
5+
6+
- task: Go@0
7+
displayName: 'Go: get dependencies'
8+
inputs:
9+
command: 'get'
10+
arguments: '-d'
11+
workingDirectory: '$(Build.SourcesDirectory)/cmd/sqlcmd'
12+
13+
- task: Go@0
14+
displayName: 'Go: build sqlcmd'
15+
inputs:
16+
command: 'build'
17+
arguments: '-o $(Build.BinariesDirectory)'
18+
workingDirectory: '$(Build.SourcesDirectory)/cmd/sqlcmd'
19+
20+
- task: CopyFiles@2
21+
inputs:
22+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
23+
SourceFolder: '$(Build.BinariesDirectory)'
24+
Contents: '**'
25+
26+
- task: PublishPipelineArtifact@1
27+
displayName: 'Publish binary'
28+
inputs:
29+
targetPath: $(Build.ArtifactStagingDirectory)
30+
artifactName: Sqlcmd$(Agent.OS)
31+
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
trigger:
2+
tags:
3+
include:
4+
- v0.*
5+
6+
stages:
7+
- stage: Compile
8+
displayName: Compile sqlcmd on all 3 platforms
9+
jobs:
10+
- job: Compile_sqlcmd
11+
strategy:
12+
matrix:
13+
linux:
14+
imageName: 'ubuntu-latest'
15+
mac:
16+
imageName: 'macOS-latest'
17+
windows:
18+
imageName: 'windows-latest'
19+
pool:
20+
vmImage: $(imageName)
21+
steps:
22+
- template: build-common.yml
23+
24+
- stage: CreatePackages
25+
displayName: Create packages to publish
26+
jobs:
27+
- job: Sign_and_pack
28+
pool:
29+
vmImage: 'windows-latest'
30+
steps:
31+
- task: PowerShell@2
32+
displayName: Set last tag to variable
33+
inputs:
34+
targetType: 'inline'
35+
script: |
36+
$VERSION_TAG = git describe --tags (git rev-list --tags --max-count=1)
37+
Write-Host("##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG")
38+
Write-Host($VERSION_TAG)
39+
40+
- task: DownloadPipelineArtifact@2
41+
inputs:
42+
buildType: 'current'
43+
targetPath: '$(Pipeline.Workspace)'
44+
45+
- task: EsrpCodeSigning@1
46+
displayName: Sign Windows binary
47+
inputs:
48+
ConnectedServiceName: 'Code Signing'
49+
FolderPath: '$(Pipeline.Workspace)\SqlcmdWindows_NT'
50+
Pattern: '*.exe'
51+
signConfigType: 'inlineSignParams'
52+
SessionTimeout: '600'
53+
MaxConcurrency: '5'
54+
MaxRetryAttempts: '5'
55+
inlineOperation: |
56+
[
57+
{
58+
"keyCode": "CP-230012",
59+
"operationSetCode": "SigntoolSign",
60+
"parameters": [
61+
{
62+
"parameterName": "OpusName",
63+
"parameterValue": "go-sqlcmd"
64+
},
65+
{
66+
"parameterName": "OpusInfo",
67+
"parameterValue": "https://github.com/microsoft/go-sqlcmd"
68+
},
69+
{
70+
"parameterName": "PageHash",
71+
"parameterValue": "/NPH"
72+
},
73+
{
74+
"parameterName": "FileDigest",
75+
"parameterValue": "/fd sha256"
76+
},
77+
{
78+
"parameterName": "TimeStamp",
79+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
80+
}
81+
],
82+
"toolName": "signtool.exe",
83+
"toolVersion": "6.2.9304.0"
84+
},
85+
{
86+
"keyCode": "CP-230012",
87+
"operationSetCode": "SigntoolVerify",
88+
"parameters": [
89+
{
90+
"parameterName": "VerifyAll",
91+
"parameterValue": "/all"
92+
}
93+
],
94+
"toolName": "signtool.exe",
95+
"toolVersion": "6.2.9304.0"
96+
}
97+
]
98+
- task: ArchiveFiles@2
99+
displayName: Zip Windows binary
100+
inputs:
101+
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdWindows_NT\Sqlcmd.exe'
102+
includeRootFolder: false
103+
archiveType: 'zip'
104+
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-windows.zip'
105+
106+
- task: ArchiveFiles@2
107+
displayName: Tar Linux binary
108+
inputs:
109+
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdLinux'
110+
includeRootFolder: false
111+
archiveType: 'tar'
112+
tarCompression: 'bz2'
113+
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-linux.tar.bz2'
114+
115+
- task: ArchiveFiles@2
116+
displayName: Tar Darwin binary
117+
inputs:
118+
rootFolderOrFile: '$(Pipeline.Workspace)\SqlcmdDarwin'
119+
includeRootFolder: false
120+
archiveType: 'tar'
121+
tarCompression: 'bz2'
122+
archiveFile: '$(Build.ArtifactStagingDirectory)/sqlcmd-$(VERSION_TAG)-darwin.tar.bz2'
123+
124+
- task: PublishPipelineArtifact@1
125+
displayName: 'Publish release archives'
126+
inputs:
127+
targetPath: $(Build.ArtifactStagingDirectory)
128+
artifactName: SqlcmdRelease
129+

0 commit comments

Comments
 (0)