-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipeline.yml
111 lines (105 loc) · 3.45 KB
/
azure-pipeline.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
trigger:
branches:
include:
- master
paths:
exclude:
- README.md
- Docs/Screenshots
pr:
branches:
include:
- master
paths:
exclude:
- README.md
- Docs/Screenshots
jobs:
- job: build_components
displayName: 'Build platform component libraries'
pool:
vmImage: 'macos-latest'
steps:
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.x'
inputs:
versionSpec: 5.x
- task: NuGetCommand@2
displayName: 'NuGet restore'
- bash: |
chmod +x build.sh
./build.sh --target=externals
workingDirectory: Build
displayName: 'Build pod framework'
- bash: |
chmod +x buildandpack.sh
./buildandpack.sh
displayName: 'Build and Generate packages'
- task: CopyFiles@2
displayName: 'Copy NuGet Package Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '*.nupkg'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: package'
inputs:
ArtifactName: package
- job: release_packages
displayName: 'GitHub and NuGet Release'
pool:
vmImage: 'macos-latest'
dependsOn: [ build_components ]
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
inputs:
itemPattern: '**/*.nupkg'
targetPath: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.SourcesDirectory)'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)'
Contents: '**/*.nupkg'
TargetFolder: '$(Build.SourcesDirectory)'
flattenFolders: true
- bash: |
export commitMessage=$(git log --format=%B -n 1)
echo $commitMessage
if [[ $commitMessage == [Vv]ersion[[:space:]]change* ]]; then
echo '##vso[task.setvariable variable=isVersionChange]true'
echo "##vso[task.setvariable variable=commit_message]$commitMessage"
fi
if $isVersionChange; then
version=$(perl -pe '($_)=/([0-9]+([.][0-9]+)+([-][Rr][Cc][0-9]+)?)/' <<< $commitMessage)
echo "##vso[task.setvariable variable=new_version]$version"
fi
displayName: 'Check version change'
- bash: |
brew install coreutils
bash get_release_description.sh
cat release_description.txt
displayName: 'Generate Release Notes File'
workingDirectory: Build
condition: and(succeeded(), eq(variables['isVersionChange'], 'true'))
- task: GitHubRelease@1
displayName: 'GitHub release (create)'
inputs:
gitHubConnection: 'GitHubRelease'
tagSource: userSpecifiedTag
tag: '$(new_version)'
title: '$(new_version)'
releaseNotesFilePath: 'Build/release_description.txt'
assets: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
isDraft: true
addChangeLog: false
condition: and(succeeded(), eq(variables['isVersionChange'], 'true'))
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: 'NuGet package release'
condition: and(succeeded(), eq(variables['isVersionChange'], 'true'))