forked from blheli-configurator/blheli-configurator
-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
154 lines (139 loc) · 5.53 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
# Builds BLHeli Configurator on Windows, Linux and OSX platforms.
#
# After building, artifacts are released to a seperate repository.
#
# Azure Pipelines requires the following extensions to be installed:
# - GitHub Tool: https://marketplace.visualstudio.com/items?itemName=marcelo-formentao.github-tools
#
# You'll also need to setup the follwing pipeline variables:
# "releaseNotes" - This is used to add the release notes in the windows job in the build stage so they can be published as part of the github release in the release stage
# "endpoint" - The name of the github endpoint link setup in AzDo - setup when linking AzDo and GitHub
# "owner" - The owner of the repository to release to e.g. blheli-configurator
# "repoName" - The name of the repository to release to e.g. blheli-configurator-nightly
variables:
owner: blheli-configurator
repoName: blheli-configurator-nightlies
debugReleaseNotes: This is a nightly build off the tip of 'master'. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.**
releaseNotes: This is a release build. It does not contain the debug console.
parameters:
- name: releaseBuild
type: boolean
default: false
name: $(Date:yyyyMMdd).$(BuildID)
trigger:
batch: true
branches:
include:
- master
pr: none
stages:
- stage: Build
jobs:
- job: 'Windows'
pool:
vmImage: 'vs2017-win2016'
steps:
- task: UseNode@1
inputs:
version: '10.16.3'
displayName: 'Install Node.js 10.16.3'
- script: yarn install
displayName: 'Run yarn install'
- script: yarn test
displayName: 'Run yarn test'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/test_results.xml'
testRunTitle: 'Windows'
buildPlatform: 'Win32'
- script: yarn gulp release --win32
displayName: 'Run yarn release for win32'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
- script: yarn gulp debug-release --win32
displayName: 'Run yarn debug release for win32'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
- powershell: Set-Content -Path '$(System.DefaultWorkingDirectory)/release/log.txt' -Value $env:BUILD_SOURCEVERSIONMESSAGE
- task: PublishPipelineArtifact@1
displayName: 'Publish Windows release'
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/release'
artifact: 'blheli-configurator-windows'
- job: 'MacOS'
pool:
vmImage: 'macos-10.15'
steps:
- task: UseNode@1
inputs:
version: '10.16.3'
displayName: 'Install Node.js 10.16.3'
- script: npm install -g gulp
displayName: 'Install Gulp'
- script: yarn install
displayName: 'Run yarn install'
- script: yarn gulp release --osx64
displayName: 'Run yarn release for OSX64'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
- script: yarn gulp debug-release --osx64
displayName: 'Run yarn debug release for OSX64'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
- task: PublishPipelineArtifact@1
displayName: 'Publish MacOS release'
inputs:
artifactName: blheli-configurator-macos
targetPath: '$(System.DefaultWorkingDirectory)/release'
- job: 'Linux'
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UseNode@1
inputs:
version: '10.16.3'
displayName: 'Install Node.js 10.16.3'
- script: yarn install
displayName: 'Run yarn install'
- script: yarn gulp release --linux64
displayName: 'Run yarn release for linux64'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', true))
- script: yarn gulp debug-release --linux64
displayName: 'Run yarn debug release for linux64'
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
- script: cd $(System.DefaultWorkingDirectory)/release; find -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
displayName: 'Clean release folders'
- task: PublishPipelineArtifact@1
displayName: 'Publish Linux release'
inputs:
artifactName: blheli-configurator-linux
targetPath: '$(System.DefaultWorkingDirectory)/release'
- stage: Release
jobs:
- job: Release
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(Pipeline.Workspace)'
- powershell: Write-Output ("##vso[task.setvariable variable=changelog;]$(gc $(Pipeline.Workspace)/blheli-configurator-windows/log.txt)")
- powershell: Write-Output ("##vso[task.setvariable variable=releaseNotes;]$(debugReleaseNotes)")
condition: and(succeeded(), eq('${{ parameters.releaseBuild }}', false))
- task: GitHubReleasePublish@1
inputs:
githubEndpoint: '$(endpoint)'
manuallySetRepository: true
githubOwner: '$(owner)'
githubRepositoryName: '$(repoName)'
githubReleaseNotes: |+
$(releaseNotes)
$(changelog)
githubReleaseDraft: false
githubReleasePrerelease: false
githubIgnoreAssets: false
githubReleaseAsset: |
$(Pipeline.Workspace)/blheli-configurator-windows/**
$(Pipeline.Workspace)/blheli-configurator-macos/**
$(Pipeline.Workspace)/blheli-configurator-linux/**
githubReuseRelease: true
githubReuseDraftOnly: true
githubSkipDuplicatedAssets: false
githubEditRelease: false
githubDeleteEmptyTag: false