-
Notifications
You must be signed in to change notification settings - Fork 144
71 lines (62 loc) · 2.16 KB
/
gh-pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: github pages
on:
push:
branches:
- master
tags:
- v*
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.8"
- run: mdbook build docs
- name: Deploy master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.REPO_TOKEN }}
publish_dir: ./docs/book
destination_dir: master
cname: install.fuel.network
user_name: 'fuel-service-user'
user_email: '[email protected]'
if: github.ref == 'refs/heads/master'
- name: Get tag
id: branch_name
run: |
echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/tags/}
if: startsWith(github.ref, 'refs/tags')
- name: Deploy tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.REPO_TOKEN }}
publish_dir: ./docs/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}
cname: install.fuel.network
user_name: 'fuel-service-user'
user_email: '[email protected]'
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.REPO_TOKEN }}
publish_dir: ./latest/
destination_dir: ./latest/
cname: install.fuel.network
user_name: 'fuel-service-user'
user_email: '[email protected]'
if: startsWith(github.ref, 'refs/tags')