This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
v0.21.0 (#1389) #571
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: github pages | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: 'latest' | |
- run: mdbook build docs | |
- name: Deploy master | |
if: github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/book | |
destination_dir: master | |
- name: Get tag | |
id: branch_name | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/tags/} | |
- name: Deploy tag | |
if: startsWith(github.ref, 'refs/tags') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/book | |
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }} | |
- name: Create latest HTML redirect file | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
mkdir ./latest | |
cat > ./latest/index.html <<EOF | |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<meta http-equiv="refresh" content="0; URL=../${{ steps.branch_name.outputs.BRANCH_NAME }}/"> | |
<link rel="canonical" href="../${{ steps.branch_name.outputs.BRANCH_NAME }}/"> | |
EOF | |
- name: Set latest to point to tag | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./latest/ | |
destination_dir: ./latest/ | |
if: startsWith(github.ref, 'refs/tags') |