You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.5 KiB

4 years ago
  1. version: 'BSIPA-{branch}-{build}'
  2. environment:
  3. bsipa_version: '4.0.0-beta.10'
  4. gh_token:
  5. secure: E42gl/yepETuoLSwbJZ1GmEIPK6cCJu6zkd59NA21XiICtEV6COOLW7aehi1tcVU
  6. do_deploy: true
  7. BuildForBeatSaber: 'false'
  8. BUILD_DOC: 'no'
  9. pull_requests:
  10. do_not_increment_build_number: true
  11. init:
  12. - git config --global core.autocrlf true
  13. install:
  14. - git submodule update --init --recursive
  15. - nuget restore
  16. - ps: |
  17. if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE -And $env:BUILD_DOC -Eq 'yes')
  18. {
  19. choco install docfx -y
  20. }
  21. image: Visual Studio 2019
  22. configuration: Release
  23. platform:
  24. - x64-Net4
  25. - x86-Net4
  26. - x64-Net3
  27. - x86-Net3
  28. artifacts: # When Net3 is added, this will need to be moved to the for block to only run for Net4 builds
  29. - path: BSIPA-ModList/bin/Release
  30. name: ModList
  31. - path: BSIPA-Meta/bin/$(platform)/$(configuration)
  32. name: BSIPA-$(platform)
  33. matrix:
  34. allow_failures:
  35. - platform: x64-Net3
  36. - platform: x86-Net3
  37. for:
  38. -
  39. matrix:
  40. only:
  41. - platform: x64-Net4
  42. environment:
  43. BuildForBeatSaber: 'true'
  44. -
  45. matrix:
  46. except:
  47. - BUILD_DOC: 'yes'
  48. skip_tags: true
  49. -
  50. matrix:
  51. only:
  52. - BUILD_DOC: 'yes'
  53. artifacts:
  54. environment:
  55. do_deploy: false
  56. skip_tags: false
  57. build_script:
  58. - ps: |
  59. cd docs
  60. $tagsName = "tags"
  61. $branchName = "branch"
  62. function Git-Do {
  63. git config --global core.autocrlf true
  64. git config --global credential.helper store
  65. Add-Content "$HOME\.git-credentials" "https://$($env:gh_token):[email protected]`n"
  66. git config --global user.email $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL
  67. git config --global user.name $env:APPVEYOR_REPO_COMMIT_AUTHOR
  68. git clone -q "https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded.git" -b gh-pages origin_site
  69. if (-Not (Test-Path origin_site/$tagsName))
  70. { New-Item -ItemType directory -Path origin_site/$tagsName }
  71. if (-Not (Test-Path origin_site/$branchName))
  72. { New-Item -ItemType directory -Path origin_site/$branchName }
  73. }
  74. function Do-DocFX
  75. {
  76. Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:APPVEYOR_REPO_COMMIT`",`"apiSpecFolder`":`"docs/override`"}}"
  77. powershell .\build.ps1
  78. if ($lastexitcode -ne 0){
  79. throw [System.Exception] "docfx build failed with exit code $lastexitcode."
  80. }
  81. }
  82. if ($env:APPVEYOR_REPO_TAG -eq "true" -And $env:APPVEYOR_REPO_BRANCH -eq 'master')
  83. { # Copy current site into tags
  84. & Do-DocFX
  85. & Git-Do
  86. cd origin_site # make things a bit easier
  87. $tagPath = "$tagsName/$env:APPVEYOR_REPO_TAG_NAME"
  88. Move-Item ../_site $tagPath
  89. git add -A 2>&1
  90. git commit -q -a -m "Saved tag $env:APPVEYOR_REPO_TAG_NAME" 2>&1
  91. }
  92. elseif (-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
  93. { # Generate docs
  94. $message = ""
  95. if ($env:APPVEYOR_REPO_BRANCH -eq 'master')
  96. { # do the special generation for master
  97. & Do-DocFX
  98. & Git-Do
  99. Move-Item origin_site/.git _site
  100. Move-Item origin_site/$tagsName _site
  101. Move-Item origin_site/$branchName _site
  102. cd _site
  103. $message = "Generated Docs -- $env:APPVEYOR_REPO_COMMIT_MESSAGE"
  104. }
  105. else
  106. { # generate for another branch; this is more similar to the tag code
  107. & Do-DocFX
  108. & Git-Do
  109. cd origin_site # make things a bit easier
  110. $branchPath = "$branchName/$env:APPVEYOR_REPO_BRANCH"
  111. # force remove it
  112. Get-ChildItem -Path $branchPath -Recurse | Remove-Item -Force -Recurse
  113. Remove-Item $branchPath -Force
  114. # move generated into place
  115. Move-Item ../_site $branchPath
  116. $message = "Generated Docs ($env:APPVEYOR_REPO_BRANCH) -- $env:APPVEYOR_REPO_COMMIT_MESSAGE"
  117. }
  118. git add -A 2>&1
  119. git commit -q -a -m "$message" 2>&1
  120. }
  121. git push -q origin gh-pages 2>&1
  122. branches:
  123. except:
  124. - gh-pages
  125. cache:
  126. - '%LocalAppData%\NuGet\v3-cache' # NuGet v3
  127. build:
  128. verbosity: normal
  129. project: BSIPA.sln
  130. deploy:
  131. - provider: GitHub
  132. release: BSIPA $(bsipa_version)-draft
  133. tag: $(bsipa_version)-d
  134. description: |
  135. **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID))
  136. **Latest Commit:** $(APPVEYOR_REPO_COMMIT)
  137. - `$(APPVEYOR_REPO_COMMIT_MESSAGE)`
  138. - `$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)`
  139. auth_token:
  140. secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t
  141. artifact: '/.*[^_]\.zip/'
  142. draft: true
  143. force_update: true
  144. on:
  145. branch: master
  146. APPVEYOR_REPO_TAG: false
  147. do_deploy: true