-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
160 lines (150 loc) · 5.45 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
# dapr/dapr pipeline
# Release process - https://github.com/dapr/dapr/wiki/Release-Process
trigger:
branches:
include:
- master
tags:
include:
- v*
variables:
GOPATH: '$(system.defaultWorkingDirectory)/gopath'
GOBIN: '$(GOPATH)/bin'
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)'
BlobPrefix: ''
name: $(Date:yyyyMMdd)$(Rev:.r)
jobs:
- job: release_environment
pool:
vmImage: ubuntu-latest
steps:
- script: |
SOURCEBRANCH=$(Build.SourceBranch)
echo Source branch name : $SOURCEBRANCH
if [[ $SOURCEBRANCH != refs/tags/v* ]]; then
echo Clearing REL_VERSION value unless $SOURCEBRANCH is refs/tags/v.
RELVERSION=""
echo "##vso[task.setvariable variable=REL_VERSION;isOutput=true]$RELVERSION"
exit 0
fi
RELVERSION=${SOURCEBRANCH#refs/tags/v}
echo Release version : $RELVERSION
echo "##vso[task.setvariable variable=REL_VERSION;isOutput=true]$RELVERSION"
echo $RELVERSION > $(Build.ArtifactStagingDirectory)/release_version.txt
echo $(Build.SourceVersion) > $(Build.ArtifactStagingDirectory)/release_commit_id.txt
# Check if RELVERSION is not release candidates and then validate the release note file
if [[ "$RELVERSION" != *-rc.* ]]; then
echo Checking release note for $RELVERSION...
RELNOTE_PATH="docs/release_notes/v$RELVERSION.md"
[ ! -f "$RELNOTE_PATH" ] && echo "$RELNOTE_PATH not found" && exit 1
echo Add release tag
echo "##vso[build.addbuildtag]release"
fi
name: env_var_step
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- template: 'build-binary-template.yml'
parameters:
poolImage: macOS-latest
targetOS: darwin
targetArch: amd64
dependStep: release_environment
relVersion: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
- template: 'build-binary-template.yml'
parameters:
poolImage: ubuntu-latest
targetOS: linux
targetArch: arm
dependStep: release_environment
relVersion: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
- template: 'build-binary-template.yml'
parameters:
poolImage: ubuntu-latest
targetOS: linux
targetArch: amd64
dependStep: release_environment
relVersion: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
- template: 'build-binary-template.yml'
parameters:
poolImage: windows-2019
targetOS: windows
targetArch: amd64
dependStep: release_environment
relVersion: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
- job: 'build_and_push_docker_image'
pool:
vmImage: 'ubuntu-latest'
dependsOn:
- release_environment
- build_darwin_amd64
- build_linux_amd64
- build_linux_arm
- build_windows_amd64
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
variables:
REL_VERSION: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
steps:
- script: |
docker login -u $(DOCKERHUB_ID) -p $(DOCKERHUB_TOKEN)
displayName: 'Login docker.io'
- template: 'build-and-push-image-template.yml'
parameters:
targetArch: amd64
releaseVersion: $(REL_VERSION)
- template: 'build-and-push-image-template.yml'
parameters:
targetArch: arm
releaseVersion: $(REL_VERSION)
- job: publish_binaries
pool:
vmImage: 'ubuntu-latest'
dependsOn:
- release_environment
- build_and_push_docker_image
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
variables:
REL_VERSION: $[ dependencies.release_environment.outputs['env_var_step.REL_VERSION'] ]
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download pipeline artifacts to workspace'
inputs:
buildType: 'current'
itemPattern: '**'
targetPath: '$(Pipeline.Workspace)'
- task: GitHubRelease@0
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], '-rc'))
displayName: 'Upload Dapr binaries to GitHub Pre-Release'
inputs:
gitHubConnection: 'GitHub'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: 'v$(REL_VERSION)'
title: 'Dapr Runtime $(REL_VERSION)'
assets: |
$(Pipeline.Workspace)/drop/*.zip
$(Pipeline.Workspace)/drop/*.tar.gz
isPreRelease: true
addChangeLog: true
- task: GitHubRelease@0
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], '-rc')))
displayName: 'Upload Dapr binaries to GitHub Release'
inputs:
gitHubConnection: 'GitHub'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'manual'
tag: 'v$(REL_VERSION)'
title: 'Dapr Runtime $(REL_VERSION)'
assets: |
$(Pipeline.Workspace)/drop/*.zip
$(Pipeline.Workspace)/drop/*.tar.gz
releaseNotesFile: './docs/release_notes/v$(REL_VERSION).md'
isPreRelease: false
addChangeLog: false