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.

186 lines
5.8 KiB

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