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.

147 lines
4.3 KiB

5 years ago
5 years ago
  1. version: 'BSIPA-{branch}-{build}'
  2. environment:
  3. bsipa_version: '3.12.24'
  4. gh_token:
  5. secure: E42gl/yepETuoLSwbJZ1GmEIPK6cCJu6zkd59NA21XiICtEV6COOLW7aehi1tcVU
  6. BUILD_DOCS: 'no'
  7. pull_requests:
  8. do_not_increment_build_number: true
  9. install:
  10. - git submodule update --init --recursive
  11. - nuget restore
  12. - ps: |
  13. if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
  14. {
  15. #git checkout $env:APPVEYOR_REPO_BRANCH -q
  16. choco install docfx -y
  17. }
  18. image: Visual Studio 2019
  19. configuration:
  20. - Release
  21. platform:
  22. - x64
  23. #- x86
  24. for:
  25. -
  26. matrix:
  27. only:
  28. - configuration: Release
  29. platform: x64
  30. environment:
  31. BUILD_DOCS: 'yes'
  32. artifacts:
  33. - path: BSIPA-ModList/bin/$(configuration)
  34. name: ModList
  35. branches:
  36. except:
  37. - gh-pages
  38. cache:
  39. - '%LocalAppData%\NuGet\v3-cache' # NuGet v3
  40. artifacts:
  41. - path: IPA/bin/$(configuration)
  42. name: BSIPA-$(platform)
  43. build:
  44. verbosity: normal
  45. project: BSIPA.sln
  46. skip_tags: false
  47. deploy:
  48. - provider: GitHub
  49. release: BSIPA $(bsipa_version)-draft
  50. tag: $(bsipa_version)-d
  51. description: |
  52. **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID)) [$(configuration)|$(platform)]
  53. **Latest Commit:** $(APPVEYOR_REPO_COMMIT)
  54. - `$(APPVEYOR_REPO_COMMIT_MESSAGE)`
  55. - `$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)`
  56. auth_token:
  57. secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t
  58. artifact: /.*\.zip/
  59. draft: true
  60. force_update: true
  61. on:
  62. branch: master
  63. APPVEYOR_REPO_TAG: false
  64. - provider: GitHub
  65. release: -ignore-
  66. tag: create_tag
  67. description: |
  68. **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID))
  69. auth_token:
  70. secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t
  71. draft: true
  72. force_update: true
  73. on:
  74. branch: master
  75. APPVEYOR_REPO_TAG: true
  76. before_deploy:
  77. - ps: |
  78. if ($env:APPVEYOR_REPO_BRANCH -eq 'master' -and $env:BUILD_DOCS -eq 'yes')
  79. {
  80. cd docs
  81. function Git-Do {
  82. git config --global core.autocrlf true
  83. git config --global credential.helper store
  84. Add-Content "$HOME\.git-credentials" "https://$($env:gh_token):[email protected]`n"
  85. git config --global user.email $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL
  86. git config --global user.name $env:APPVEYOR_REPO_COMMIT_AUTHOR
  87. git clone -q "https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded.git" -b gh-pages origin_site
  88. if (-Not (Test-Path origin_site/tags))
  89. { New-Item -ItemType directory -Path origin_site/tags }
  90. }
  91. function Do-DocFX
  92. {
  93. Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:APPVEYOR_REPO_COMMIT`",`"apiSpecFolder`":`"docs/override`"}}"
  94. & docfx metadata
  95. & docfx build --globalMetadataFiles link_branch.json @Args
  96. if ($lastexitcode -ne 0){
  97. throw [System.Exception] "docfx build failed with exit code $lastexitcode."
  98. }
  99. }
  100. if ($env:APPVEYOR_REPO_TAG -eq "true")
  101. { # Copy current site into tags
  102. & Do-DocFX
  103. & Git-Do
  104. cd origin_site # make things a bit easier
  105. $tagPath = "tags/$env:APPVEYOR_REPO_TAG_NAME"
  106. Move-Item ../_site $tagPath
  107. git add -A 2>&1
  108. git commit -q -a -m "Saved tag $env:APPVEYOR_REPO_TAG_NAME" 2>&1
  109. }
  110. elseif (-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
  111. { # Generate docs
  112. & Do-DocFX
  113. & Git-Do
  114. Move-Item origin_site/.git _site
  115. Move-Item origin_site/tags _site
  116. CD _site
  117. git add -A 2>&1
  118. git commit -q -a -m "$env:APPVEYOR_REPO_COMMIT_MESSAGE -- Generated Docs" 2>&1
  119. }
  120. git push -q origin gh-pages 2>&1
  121. }