Merge pull request #3060 from planetarium/release/1.20.2 #322
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish docs | |
on: | |
push: | |
branches-ignore: | |
- v* | |
tags-ignore: | |
- v* | |
jobs: | |
publish-docs: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Dotnet Setup | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.400 | |
- run: dotnet restore | |
- run: dotnet tool restore | |
- run: dotnet docfx docs/docfx.json | |
- name: update index.html | |
run: | | |
set -ev | |
if [[ "${{ github.ref_name }}" =~ ^v ]]; then | |
echo "Prevent tags started with 'v'" >&2 | |
exit | |
fi | |
mkdir -p /tmp/gh-pages-root | |
latest_version=$(git tag --sort -v:refname | grep -E -i '^[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) | |
if [[ "$latest_version" = "${{ github.ref_name }}" ]]; then | |
index=$(cat docs/_site/index.html) | |
{ | |
echo -n "${index%</title>*}</title>" | |
echo "<meta http-equiv=\"refresh\" content=\"0;${{ github.ref_name }}/\">" | |
echo "<base href=\"${{ github.ref_name }}/\">" | |
echo -n "${index#*</title>}" | |
} > /tmp/gh-pages-root/index.html | |
fi | |
if: github.ref_type == 'tag' | |
- name: deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_site/ | |
destination_dir: ${{ github.ref_name }} | |
- name: deploy (index.html) | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: /tmp/gh-pages-root | |
destination_dir: . | |
keep_files: true | |
if: github.ref_type == 'tag' |