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.

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