-
Notifications
You must be signed in to change notification settings - Fork 38
/
release-branch-pipeline.yml
84 lines (72 loc) · 2.89 KB
/
release-branch-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
trigger:
- release
pr: none
pool:
vmImage: "ubuntu-latest"
variables:
VERSION:
steps:
# Checks if the release notes file is populated. Exits if it is not.
- bash: |
if [ -s RELEASE_NOTES.md ]
then
echo "RELEASE_NOTES.md has data, proceeding to next step."
else
echo "Your RELEASE_NOTES.md file is empty. Please provide release notes before creating a release."
exit 1
fi
# This task pulls the <version> value from the pom.xml file, so we can set it to the variable $version.
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
[xml]$pomXml = Get-Content .\pom.xml
# version
Write-Host $pomXml.project.version
$version=$pomXml.project.version
Write-Host "##vso[task.setvariable variable=version]$version"
# Runs 'mvn package'
- task: Maven@4
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
# Prints out the build version, for debugging purposes
- bash: echo Pulled version from pom.xml => $(version)
# Copies the generated *.jar file to the staging directory.
# This is done for release versions only.
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: "$(System.DefaultWorkingDirectory)/target/fhir-test-cases-$(version).jar"
TargetFolder: '$(build.artifactstagingdirectory)'
# Azure pipelines cannot pass variables between pipelines, but it can pass files, so we
# pass the build id (ex: 1.1.13-SNAPSHOT) as a string in a file.
# This is used in the release pipeline, so we create it here.
# This is only done for the release branch.
- bash: |
echo $(version)
VERSION=$(version)
echo "$VERSION" > $(System.DefaultWorkingDirectory)/VERSION
# Copies the VERSION file containing the build id (ex: 1.1.13-SNAPSHOT) to the staging directory
# This is done for release versions only.
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(System.Defaultworkingdirectory)'
Contents: "$(System.DefaultWorkingDirectory)/VERSION"
TargetFolder: '$(build.artifactstagingdirectory)'
# Publishes the files we've moved into the staging directory, so they can be accessed by the
# release pipeline. You will notice that we only do this for the ubuntu build, as doing it
# for each of the three release pipelines will cause conflicts.
# This is done for release versions only.
- task: PublishBuildArtifacts@1
displayName: 'Publish Build Artifacts'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'