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
6.1 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. except:
  57. - BUILD_DOC: 'no'
  58. artifacts:
  59. environment:
  60. do_deploy: false
  61. skip_tags: false
  62. build_script:
  63. - ps: |
  64. if ($env:BUILD_DOC -Eq 'yes')
  65. {
  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. }
  130. branches:
  131. except:
  132. - gh-pages
  133. cache:
  134. - '%LocalAppData%\NuGet\v3-cache' # NuGet v3
  135. build:
  136. verbosity: normal
  137. project: BSIPA.sln
  138. deploy:
  139. - provider: GitHub
  140. release: BSIPA $(bsipa_version)-draft
  141. tag: $(bsipa_version)-d
  142. description: |
  143. **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID))
  144. **Latest Commit:** $(APPVEYOR_REPO_COMMIT)
  145. - `$(APPVEYOR_REPO_COMMIT_MESSAGE)`
  146. - `$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)`
  147. auth_token:
  148. secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t
  149. artifact: '/.*[^_]\.zip/'
  150. draft: true
  151. force_update: true
  152. on:
  153. branch: master
  154. APPVEYOR_REPO_TAG: false
  155. do_deploy: true