From a25e937ba72f4dd18a23c568313d212f02adea11 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Fri, 3 Jan 2020 21:25:01 -0600 Subject: [PATCH] Added online docs for branch commits --- appveyor.yml | 363 +++++++++++++++++++++++++++------------------------ 1 file changed, 194 insertions(+), 169 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6467518c..4c367c45 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,169 +1,194 @@ -version: 'BSIPA-{branch}-{build}' - -environment: - bsipa_version: '4.0.0-beta.2' - gh_token: - secure: E42gl/yepETuoLSwbJZ1GmEIPK6cCJu6zkd59NA21XiICtEV6COOLW7aehi1tcVU - - do_deploy: true - BuildForBeatSaber: 'false' - matrix: - - BUILD_DOC: 'no' - - BUILD_DOC: 'yes' - -pull_requests: - do_not_increment_build_number: true - -install: - - git submodule update --init --recursive - - nuget restore - - ps: | - if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE -And $env:BUILD_DOC -Eq 'yes') - { - #git checkout $env:APPVEYOR_REPO_BRANCH -q - choco install docfx -y - } - -image: Visual Studio 2019 - -configuration: Release -platform: - - x64-Net4 - - x86-Net4 - - x64-Net3 - - x86-Net3 - -artifacts: # When Net3 is added, this will need to be moved to the for block to only run for Net4 builds - - path: BSIPA-ModList/bin/Release - name: ModList - - path: BSIPA-Meta/bin/$(platform)/$(configuration) - name: BSIPA-$(platform) - -matrix: - exclude: - # Don't exclude Release_Net4|x64 - - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe - platform: x86-Net4 - - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe - platform: x64-Net3 - - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe - platform: x86-Net3 - -before_build: -- ps: | - echo $env:Configuration $env:Platform $env:BuildingInsideVisualStudio - -for: -- - matrix: - only: - - platform: x64-Net4 - environment: - BuildForBeatSaber: 'true' -- - matrix: - except: - - BUILD_DOC: 'yes' - - skip_tags: true -- - matrix: - except: - - BUILD_DOC: 'no' - - artifacts: - environment: - do_deploy: false - skip_tags: false - build_script: - - ps: | - if ($env:APPVEYOR_REPO_BRANCH -eq 'master') - { - cd docs - - function Git-Do { - git config --global core.autocrlf true - git config --global credential.helper store - Add-Content "$HOME\.git-credentials" "https://$($env:gh_token):x-oauth-basic@github.com`n" - git config --global user.email $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL - git config --global user.name $env:APPVEYOR_REPO_COMMIT_AUTHOR - git clone -q "https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded.git" -b gh-pages origin_site - - if (-Not (Test-Path origin_site/tags)) - { New-Item -ItemType directory -Path origin_site/tags } - } - - function Do-DocFX - { - Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:APPVEYOR_REPO_COMMIT`",`"apiSpecFolder`":`"docs/override`"}}" - #& docfx metadata - #& docfx build --globalMetadataFiles link_branch.json @Args - #if ($lastexitcode -ne 0){ - # throw [System.Exception] "docfx build failed with exit code $lastexitcode." - #} - powershell .\build.ps1 - if ($lastexitcode -ne 0){ - throw [System.Exception] "docfx build failed with exit code $lastexitcode." - } - } - - if ($env:APPVEYOR_REPO_TAG -eq "true") - { # Copy current site into tags - & Do-DocFX - - & Git-Do - - cd origin_site # make things a bit easier - - $tagPath = "tags/$env:APPVEYOR_REPO_TAG_NAME" - Move-Item ../_site $tagPath - - git add -A 2>&1 - git commit -q -a -m "Saved tag $env:APPVEYOR_REPO_TAG_NAME" 2>&1 - } - elseif (-Not $env:APPVEYOR_PULL_REQUEST_TITLE) - { # Generate docs - & Do-DocFX - - & Git-Do - - Move-Item origin_site/.git _site - Move-Item origin_site/tags _site - - CD _site - git add -A 2>&1 - git commit -q -a -m "$env:APPVEYOR_REPO_COMMIT_MESSAGE -- Generated Docs" 2>&1 - } - - git push -q origin gh-pages 2>&1 - } - -branches: - except: - - gh-pages - -cache: - - '%LocalAppData%\NuGet\v3-cache' # NuGet v3 - -build: - verbosity: normal - project: BSIPA.sln - -deploy: -- provider: GitHub - release: BSIPA $(bsipa_version)-draft - tag: $(bsipa_version)-d - description: | - **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID)) - **Latest Commit:** $(APPVEYOR_REPO_COMMIT) - - `$(APPVEYOR_REPO_COMMIT_MESSAGE)` - - `$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)` - auth_token: - secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t - artifact: '/.*[^_]\.zip/' - draft: true - force_update: true - on: - branch: master - APPVEYOR_REPO_TAG: false - do_deploy: true +version: 'BSIPA-{branch}-{build}' + +environment: + bsipa_version: '4.0.0-beta.2' + gh_token: + secure: E42gl/yepETuoLSwbJZ1GmEIPK6cCJu6zkd59NA21XiICtEV6COOLW7aehi1tcVU + + do_deploy: true + BuildForBeatSaber: 'false' + matrix: + - BUILD_DOC: 'no' + - BUILD_DOC: 'yes' + +pull_requests: + do_not_increment_build_number: true + +install: + - git submodule update --init --recursive + - nuget restore + - ps: | + if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE -And $env:BUILD_DOC -Eq 'yes') + { + #git checkout $env:APPVEYOR_REPO_BRANCH -q + choco install docfx -y + } + +image: Visual Studio 2019 + +configuration: Release +platform: + - x64-Net4 + - x86-Net4 + - x64-Net3 + - x86-Net3 + +artifacts: # When Net3 is added, this will need to be moved to the for block to only run for Net4 builds + - path: BSIPA-ModList/bin/Release + name: ModList + - path: BSIPA-Meta/bin/$(platform)/$(configuration) + name: BSIPA-$(platform) + +matrix: + exclude: + # Don't exclude Release_Net4|x64 + - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe + platform: x86-Net4 + - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe + platform: x64-Net3 + - BUILD_DOC: 'yes' # Add one of these for most configuration sets, so we don't dupe + platform: x86-Net3 + +before_build: +- ps: | + echo $env:Configuration $env:Platform $env:BuildingInsideVisualStudio + +for: +- + matrix: + only: + - platform: x64-Net4 + environment: + BuildForBeatSaber: 'true' +- + matrix: + except: + - BUILD_DOC: 'yes' + + skip_tags: true +- + matrix: + except: + - BUILD_DOC: 'no' + + artifacts: + environment: + do_deploy: false + skip_tags: false + build_script: + - ps: | + if ($True) + { + cd docs + + $tagsName = "tags" + $branchName = "branch" + + function Git-Do { + git config --global core.autocrlf true + git config --global credential.helper store + Add-Content "$HOME\.git-credentials" "https://$($env:gh_token):x-oauth-basic@github.com`n" + git config --global user.email $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL + git config --global user.name $env:APPVEYOR_REPO_COMMIT_AUTHOR + git clone -q "https://github.com/beat-saber-modding-group/BeatSaber-IPA-Reloaded.git" -b gh-pages origin_site + + if (-Not (Test-Path origin_site/$tagsName)) + { New-Item -ItemType directory -Path origin_site/$tagsName } + if (-Not (Test-Path origin_site/$branchName)) + { New-Item -ItemType directory -Path origin_site/$branchName } + } + + function Do-DocFX + { + Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:APPVEYOR_REPO_COMMIT`",`"apiSpecFolder`":`"docs/override`"}}" + powershell .\build.ps1 + if ($lastexitcode -ne 0){ + throw [System.Exception] "docfx build failed with exit code $lastexitcode." + } + } + + if ($env:APPVEYOR_REPO_TAG -eq "true" -And $env:APPVEYOR_REPO_BRANCH -eq 'master') + { # Copy current site into tags + & Do-DocFX + + & Git-Do + + cd origin_site # make things a bit easier + + $tagPath = "$tagsName/$env:APPVEYOR_REPO_TAG_NAME" + Move-Item ../_site $tagPath + + git add -A 2>&1 + git commit -q -a -m "Saved tag $env:APPVEYOR_REPO_TAG_NAME" 2>&1 + } + elseif (-Not $env:APPVEYOR_PULL_REQUEST_TITLE) + { # Generate docs + $message = "" + if ($env:APPVEYOR_REPO_BRANCH -eq 'master') + { # do the special generation for master + & Do-DocFX + + & Git-Do + + Move-Item origin_site/.git _site + Move-Item origin_site/$tagsName _site + Move-Item origin_site/$branchName _site + + cd _site + + $message = "Generated Docs -- $env:APPVEYOR_REPO_COMMIT_MESSAGE" + } + else + { # generate for another branch; this is more similar to the tag code + & Do-DocFX + + & Git-Do + + cd origin_site # make things a bit easier + + $branchPath = "$branchName/$env:APPVEYOR_REPO_BRANCH" + # force remove it + Get-ChildItem -Path $branchPath -Recurse | Remove-Item -Force -Recurse + Remove-Item $branchPath -Force + + # move generated into place + Move-Item ../_site $branchPath + + $message = "Generated Docs ($env:APPVEYOR_REPO_BRANCH) -- $env:APPVEYOR_REPO_COMMIT_MESSAGE" + } + git add -A 2>&1 + git commit -q -a -m "$message" 2>&1 + } + + git push -q origin gh-pages 2>&1 + } + +branches: + except: + - gh-pages + +cache: + - '%LocalAppData%\NuGet\v3-cache' # NuGet v3 + +build: + verbosity: normal + project: BSIPA.sln + +deploy: +- provider: GitHub + release: BSIPA $(bsipa_version)-draft + tag: $(bsipa_version)-d + description: | + **Build:** [$(bsipa_version)-$(APPVEYOR_BUILD_NUMBER)](https://ci.appveyor.com/project/nike4613/beatsaber-ipa-reloaded-9smsb/builds/$(APPVEYOR_BUILD_ID)) + **Latest Commit:** $(APPVEYOR_REPO_COMMIT) + - `$(APPVEYOR_REPO_COMMIT_MESSAGE)` + - `$(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)` + auth_token: + secure: KhF3q/zWEFwrW0QeZLqE3NAkWR4u9iVhsmcyzXvwwJ28fUy+MzW4CWBx3RxNM60t + artifact: '/.*[^_]\.zip/' + draft: true + force_update: true + on: + branch: master + APPVEYOR_REPO_TAG: false + do_deploy: true