Skip to content

Commit

Permalink
Split book into latest and master. (FuelLabs#2025)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerjohn authored Jun 17, 2022
1 parent 5a124ba commit 9815ffa
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ jobs:
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.15'
mdbook-version: "0.4.15"

- run: MDBOOK_preprocessor__FORC_documenter__STRICT="true" mdbook build docs

- name: Deploy latest
- name: Deploy master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
destination_dir: latest
destination_dir: master
if: github.ref == 'refs/heads/master'

- name: Get tag
Expand All @@ -62,3 +62,22 @@ jobs:
publish_dir: ./docs/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}
if: startsWith(github.ref, 'refs/tags')

- 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')

0 comments on commit 9815ffa

Please sign in to comment.