azure-pipelines.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Gradle
  2. # Build your Java project and run tests with Gradle using a Gradle wrapper script.
  3. # Add steps that analyze code, save build artifacts, deploy, and more:
  4. # https://docs.microsoft.com/azure/devops/pipelines/languages/java
  5. pool:
  6. vmImage: 'Ubuntu-latest'
  7. variables:
  8. revision: $[counter('release-number', 0)]
  9. steps:
  10. - powershell: |
  11. (Get-Content ./gradle.properties).Split([Environment]::NewLine) | % {
  12. $kvp = $_.Split('=')
  13. if ($kvp.Count -gt 1) {
  14. $key = $kvp[0] -replace "\.", "_";
  15. $value = $kvp[1];
  16. Write-Host "##vso[task.setvariable variable=javaprops_$key]$value"
  17. }
  18. }
  19. - powershell: |
  20. $var = (gci env:*).GetEnumerator() | Sort-Object Name
  21. $out = ""
  22. Foreach ($v in $var) {$out = $out + "`t{0,-28} = {1,-28}`n" -f $v.Name, $v.Value}
  23. $fileName = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/variables.md"
  24. write-output "dump variables on $fileName"
  25. set-content $fileName $out
  26. write-output "##vso[task.addattachment type=Distributedtask.Core.Summary;name=Environment Variables;]$fileName"
  27. displayName: Dump Variables
  28. condition: eq(variables['system.debug'], 'true')
  29. - task: Gradle@2
  30. inputs:
  31. workingDirectory: ''
  32. options: '-PCIRevision=$(javaprops_mod_version).$(revision) -PCIType=RELEASE'
  33. gradleWrapperFile: 'gradlew'
  34. gradleOptions: '-Xmx3072m'
  35. javaHomeOption: 'JDKVersion'
  36. jdkVersionOption: '1.8'
  37. jdkArchitectureOption: 'x64'
  38. publishJUnitResults: false
  39. testResultsFiles: '**/TEST-*.xml'
  40. tasks: 'build'
  41. - task: CopyFiles@2
  42. inputs:
  43. sourceFolder: './build/libs/'
  44. contents: 'twilightforest-*-universal.jar'
  45. targetFolder: $(build.artifactStagingDirectory)/release
  46. condition: and(succeeded(), eq(variables['CreateArtifacts'], 'True'))
  47. - task: Gradle@2
  48. inputs:
  49. workingDirectory: ''
  50. gradleWrapperFile: 'gradlew'
  51. gradleOptions: '-Xmx3072m'
  52. javaHomeOption: 'JDKVersion'
  53. jdkVersionOption: '1.8'
  54. jdkArchitectureOption: 'x64'
  55. publishJUnitResults: false
  56. tasks: 'clean'
  57. condition: and(succeeded(), eq(variables['CreateArtifacts'], 'True'))
  58. - task: Gradle@2
  59. inputs:
  60. workingDirectory: ''
  61. options: '-PCIRevision=$(javaprops_mod_version).$(revision)-beta -PCIType=BETA'
  62. gradleWrapperFile: 'gradlew'
  63. gradleOptions: '-Xmx3072m'
  64. javaHomeOption: 'JDKVersion'
  65. jdkVersionOption: '1.8'
  66. jdkArchitectureOption: 'x64'
  67. publishJUnitResults: false
  68. testResultsFiles: '**/TEST-*.xml'
  69. tasks: 'build'
  70. condition: and(succeeded(), eq(variables['CreateArtifacts'], 'True'))
  71. - task: CopyFiles@2
  72. inputs:
  73. sourceFolder: './build/libs/'
  74. contents: 'twilightforest-*-beta-universal.jar'
  75. targetFolder: $(build.artifactStagingDirectory)/beta
  76. condition: and(succeeded(), eq(variables['CreateArtifacts'], 'True'))
  77. - task: PublishBuildArtifacts@1
  78. displayName: 'Publish Build Artifacts to VSTS'
  79. condition: and(succeeded(), eq(variables['CreateArtifacts'], 'True'))