-
Notifications
You must be signed in to change notification settings - Fork 5.4k
166 lines (146 loc) · 5.61 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: github pages
on:
push:
branches:
- master
tags:
- v*
jobs:
deploy:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install Forc
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug --path ./forc
- name: Install Forc plugins
run: |
cargo install --locked --debug --path ./forc-plugins/forc-fmt
cargo install --locked --debug --path ./forc-plugins/forc-lsp
cargo install --locked --debug --path ./forc-plugins/forc-client
cargo install --locked --debug --path ./forc-plugins/forc-debug
cargo install --locked --debug --path ./forc-plugins/forc-doc
cargo install --locked --debug --path ./forc-plugins/forc-crypto
cargo install --locked --debug forc-explore
- name: Install mdbook-forc-documenter
uses: actions-rs/cargo@v1
with:
command: install
args: --locked --debug --path ./scripts/mdbook-forc-documenter
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.25"
- name: Build Sway book
run: MDBOOK_preprocessor__FORC_documenter__STRICT="true" mdbook build docs/book
- name: Build Sway reference
run: mdbook build docs/reference
- name: Build Sway std library
run: forc doc --manifest-path ./sway-lib-std
- name: Deploy master std
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc
destination_dir: master
if: github.ref == 'refs/heads/master'
- name: Deploy master book
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book/book
destination_dir: master/book
if: github.ref == 'refs/heads/master'
- name: Deploy master reference
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/reference/book
destination_dir: master/reference
if: github.ref == 'refs/heads/master'
- name: Create master book redirect file
run: |
mkdir ./tmp
cat > ./tmp/index.html <<EOF
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=../master/book">
<link rel="canonical" href="../master/book">
EOF
if: github.ref == 'refs/heads/master'
- name: Deploy index.html redirect file to master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tmp
destination_dir: ./master
keep_files: true
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 book tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/book
if: startsWith(github.ref, 'refs/tags')
- name: Deploy reference tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/reference/book
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/reference
if: startsWith(github.ref, 'refs/tags')
- name: Deploy std tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./sway-lib-std/out/doc/std
destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }}/std
if: startsWith(github.ref, 'refs/tags')
- name: Create tag book redirect file
run: |
mkdir ./tmp
cat > ./tmp/index.html <<EOF
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; URL=../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
<link rel="canonical" href="../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
EOF
if: startsWith(github.ref, 'refs/tags')
- name: Deploy index.html redirect file to tag
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tmp
destination_dir: ./${{ steps.branch_name.outputs.BRANCH_NAME }}
keep_files: true
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 }}/book">
<link rel="canonical" href="../${{ steps.branch_name.outputs.BRANCH_NAME }}/book">
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')