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.

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