Repository navigation
Expand file tree
/
Copy pathbuild-common.yml
More file actions
91 lines (81 loc) · 2.54 KB
/
Copy pathbuild-common.yml
File metadata and controls
91 lines (81 loc) · 2.54 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
parameters:
- name: OS
type: string
default:
- name: Arch
type: string
- name: ArtifactName
type: string
- name: VersionTag
type: string
default: $(Build.BuildNumber)
- name: BinaryName
type: string
- name: BinaryExt
type: string
steps:
- task: GoTool@0
inputs:
version: '1.20'
goBin: $(Build.SourcesDirectory)
- task: Go@0
displayName: 'Go install go-winres'
inputs:
command: 'custom'
customCommand: 'install'
arguments: 'github.com/tc-hib/go-winres@latest'
workingDirectory: '$(Build.SourcesDirectory)/cmd/modern'
env:
GOBIN: $(Build.SourcesDirectory)
- task: CmdLine@2
displayName: 'generate version resource'
inputs:
script: $(Build.SourcesDirectory)/go-winres make --file-version git-tag --product-version git-tag
workingDirectory: '$(Build.SourcesDirectory)/cmd/modern'
- task: Go@0
displayName: 'Go: get dependencies'
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(Build.SourcesDirectory)/cmd/modern'
env:
GOOS: ${{ parameters.OS }}
GOARCH: ${{ parameters.Arch }}
GOBIN: $(Build.SourcesDirectory)
- task: Go@0
displayName: 'Go: build sqlcmd'
inputs:
command: 'build'
arguments: '-o $(Build.BinariesDirectory)/${{ parameters.BinaryName }}${{ parameters.BinaryExt }} -ldflags="-s -w -X main.version=${{ parameters.VersionTag }}"'
workingDirectory: '$(Build.SourcesDirectory)/cmd/modern'
env:
GOOS: ${{ parameters.OS }}
GOARCH: ${{ parameters.Arch }}
GOBIN: $(Build.SourcesDirectory)
CGO_ENABLED: 0 # Enables Docker image based off 'scratch'
- task: Go@0
displayName: 'Go: build sqlcmd with debug symbols'
inputs:
command: 'build'
arguments: '-o $(Build.BinariesDirectory)/${{ parameters.BinaryName }}_debug${{ parameters.BinaryExt }} -ldflags="-X main.version=${{ parameters.VersionTag }}"'
workingDirectory: '$(Build.SourcesDirectory)/cmd/modern'
env:
GOOS: ${{ parameters.OS }}
GOARCH: ${{ parameters.Arch }}
GOBIN: $(Build.SourcesDirectory)
CGO_ENABLED: 0 # Enables Docker image based off 'scratch'
- task: CopyFiles@2
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '**'
- task: CopyFiles@2
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
SourceFolder: '$(Build.SourcesDirectory)'
Contents: 'NOTICE.md'
- task: PublishPipelineArtifact@1
displayName: 'Publish binary'
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: 'Sqlcmd${{ parameters.ArtifactName }}'