|
|
- name: Tag Docs
-
- on:
- release:
- types: [ "published" ]
-
- jobs:
- docs:
- env:
- ORIGIN_SITE: _origin_site
- TAGS_DIR: tags
- BRANCH_DIR: branch
- name: Generate docs
- runs-on: windows-latest
- steps:
- - name: Configure git
- shell: powershell
- run: |
- git config --global core.autocrlf true
- git config --global user.email (($env:GITHUB_ACTOR,"@users.noreply.github.com") -join "")
- git config --global user.name $env:GITHUB_ACTOR
- - name: Checkout branch
- uses: actions/checkout@v2
- - name: Checkout submodules
- run: git submodule update --init --recursive
- - name: Locate MSBuild
- uses: microsoft/[email protected]
- - name: Setup .NET Core
- uses: actions/setup-dotnet@v1
- with:
- # As usual, obtained from: https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/5.0/releases.json
- dotnet-version: "6.0.100" # since we now use this
- - name: Log in to package source
- shell: pwsh
- run: |
- dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} `
- --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Atlas-Rhythm/index.json"
- - name: Clear Nuget Cache
- run: dotnet nuget locals all --clear
- - name: Nuget Restore
- run: msbuild -t:Restore -m
- - name: Install DocFX
- uses: crazy-max/ghaction-chocolatey@v1
- with:
- args: install docfx -y
- - name: Checkout current pages
- uses: actions/checkout@v2
- with:
- ref: gh-pages
- token: ${{ secrets.pagesCommitToken }}
- path: docs/${{ env.ORIGIN_SITE }}
- - name: Build docs
- shell: powershell
- working-directory: ./docs
- run: |
- Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:GITHUB_SHA`",`"apiSpecFolder`":`"docs/override`"}}"
- powershell .\build.ps1
- if ($lastexitcode -ne 0) {
- throw [System.Exception] "docfx build failed with exit code $lastexitcode."
- }
- - name: Publish tag site to GitHub pages
- shell: powershell
- working-directory: ./docs
- run: |
- $ErrorActionPreference = "Continue"
- $tagName = (git rev-parse --abbrev-ref=loose $env:GITHUB_REF) -join ""
- cd $env:ORIGIN_SITE
- if (-Not (Test-Path $env:TAGS_DIR)) {
- New-Item -ItemType directory -Path $env:TAGS_DIR
- }
- $tagPath = "$env:TAGS_DIR/$tagName"
- if (Test-Path $tagPath) {
- # force remove it
- Get-ChildItem -Path $tagPath -Recurse | Remove-Item -Force -Recurse
- Remove-Item $tagPath -Force
- }
- # move generated into place
- Move-Item ../_site $tagPath
- git add -A 2>&1
- git commit -q -a -m "Saved tag $tagName"
- git push -q origin gh-pages
|