-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
222 lines (195 loc) · 6.85 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
- develop
jobs:
- job: BaseBuild
timeoutInMinutes: 5
strategy:
matrix:
linux:
name: 'linux'
arch: 'x64'
imageName: 'ubuntu-18.04'
extension: ''
cmdPrefix: ''
target: 'linux-x64'
#mac:
# name: 'mac'
# arch: 'x64'
# imageName: 'macos-10.13'
# extension: ''
# cmdPrefix: ''
# target: 'mac'
win64:
name: 'win64'
arch: 'x64'
imageName: 'vs2017-win2016'
extension: '.exe'
cmdPrefix: 'CALL'
target: 'windows-x64'
win32:
name: 'win32'
arch: 'x86'
imageName: 'vs2017-win2016'
extension: '.exe'
cmdPrefix: 'CALL'
target: 'windows-x86'
pool:
vmImage: $(imageName)
steps:
- task: UseNode@1
inputs:
version: '12.13.0'
- script: |
$(cmdPrefix) rm -rf node_modules
$(cmdPrefix) rm -rf ~/.nexe
$(cmdPrefix) rm -rf $(Build.BinariesDirectory)/bin/$(name)
$(cmdPrefix) npm install --production
$(cmdPrefix) npm install nexe@next --global
$(cmdPrefix) nexe --clean /dev/null 2>&1
$(cmdPrefix) nexe index.js --target $(target) --resource "node_modules/**/*" --temp $(Agent.TempDirectory) --output $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
$(cmdPrefix) chmod +x $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
echo -----test result------
$(cmdPrefix) ls -lh $(Build.BinariesDirectory)/bin/$(name)
$(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
displayName: 'package'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/bin/$(name)/'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(name).zip'
replaceExistingArchive: true
- script: $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version >> $(Build.ArtifactStagingDirectory)/version
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'picgo-cli'
publishLocation: 'Container'
- script: |
$(cmdPrefix) echo "ls System.ArtifactsDirectory"
$(cmdPrefix) ls -a $(System.ArtifactsDirectory)
$(cmdPrefix) echo "ls System.ArtifactStagingDirectory"
$(cmdPrefix) ls -a $(Build.ArtifactStagingDirectory)
$(cmdPrefix) echo "check version"
$(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
displayName: 'check result'
## Build and codesign macOS binaries
#- job: MacBuild
# variables:
# name: 'mac'
# arch: 'x64'
# imageName: 'macos-10.13'
# extension: ''
# cmdPrefix: ''
# target: 'mac'
# pool:
# vmImage: 'macos-10.13'
# steps:
# - task: UseNode@1
# inputs:
# version: '12.x'
# - task: CmdLine@2
# env:
# binFolder: $(Build.BinariesDirectory)
# inputs:
# script: |
# npm install --production
# npm install nexe@next --global
# npm link nexe@next
# npm run build-mac
# chmod +x $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension)
# echo -----test result------
# ls -lh $(Build.BinariesDirectory)/bin/$(name)
# $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
# displayName: 'package'
# - task: InstallAppleCertificate@2
# inputs:
# certSecureFile: 'picgo.p12'
# certPwd: '$(p12-password)'
# keychain: 'temp'
# - script: |
# codesign --force --sign Developer $(Build.BinariesDirectory)/bin/mac/picgo
# - task: ArchiveFiles@2
# inputs:
# rootFolderOrFile: '$(Build.BinariesDirectory)/bin/$(name)/'
# includeRootFolder: true
# archiveType: 'zip'
# archiveFile: '$(Build.ArtifactStagingDirectory)/$(name).zip'
# replaceExistingArchive: true
# - script: $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version >> $(Build.ArtifactStagingDirectory)/version
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: '$(Build.ArtifactStagingDirectory)'
# ArtifactName: 'picgo-cli'
# publishLocation: 'Container'
# - script: |
# $(cmdPrefix) echo "ls System.ArtifactsDirectory"
# $(cmdPrefix) ls -a $(System.ArtifactsDirectory)
# $(cmdPrefix) echo "ls System.ArtifactStagingDirectory"
# $(cmdPrefix) ls -a $(Build.ArtifactStagingDirectory)
# $(cmdPrefix) echo "check version"
# $(cmdPrefix) $(Build.BinariesDirectory)/bin/$(name)/picgo$(extension) --version
# displayName: 'check result'
- job: Release
dependsOn:
- BaseBuild
#- MacBuild
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
ls -a $(System.ArtifactsDirectory)
echo '----'
ls -a $(System.ArtifactsDirectory)/picgo-cli
version=$(cat $(System.ArtifactsDirectory)/picgo-cli/version)
echo "version is $version"
echo "##vso[task.setvariable variable=picgo.version;]$version"
echo "picgo.version is $PICGO_VERSION"
displayName: 'check result'
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: GitHubReleaseForMasterLatest
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: 'latest'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
- task: GitHubRelease@1
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
name: GitHubReleaseForVersion
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(picgo.version)'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
- task: GitHubRelease@1
name: GitHubReleaseForDevelopLatest
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'))
inputs:
gitHubConnection: 'github.com_abnerlee'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: 'latest-develop'
assets: '$(Build.ArtifactStagingDirectory)/picgo-cli/*'
assetUploadMode: 'replace'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'