forked from neovide/neovide
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (110 loc) · 3.86 KB
/
website.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
name: Build and Publish Website
on:
push:
paths:
- ".github/workflows/website.yml"
- "website/**"
- "!website/README.md"
jobs:
build:
name: Build Website
runs-on: ubuntu-latest
env:
MDBOOK-VERSION: v0.4.21
MDBOOK-PAGETOC-VERSION: v0.1.4
MDBOOK-LINKCHECK-VERSION: v0.7.6
CARGO_TERM_COLOR: always
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Restore mdBook Cache
id: cache-mdbook
uses: actions/cache@v3
with:
path: ./mdbook
key: mdbook-${{ env.MDBOOK-VERSION }}
- name: Install mdbook
if: steps.cache-mdbook.outputs.cache-hit != 'true'
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/${{ env.MDBOOK-VERSION }}/mdbook-${{ env.MDBOOK-VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
- name: Restore mdbook-pagetoc Cache
id: cache-mdbook-pagetoc
uses: actions/cache@v3
with:
path: ./mdbook-pagetoc
key: mdbook-pagetoc-${{ env.MDBOOK-PAGETOC-VERSION }}
- name: Install mdbook-pagetoc
if: steps.cache-mdbook-pagetoc.outputs.cache-hit != 'true'
run: |
mkdir mdbook-pagetoc
curl -sSL https://github.com/slowsage/mdbook-pagetoc/releases/download/${{ env.MDBOOK-PAGETOC-VERSION }}/mdbook-pagetoc-${{ env.MDBOOK-PAGETOC-VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-pagetoc
- name: Restore mdbook-linkcheck Cache
id: cache-mdbook-linkcheck
uses: actions/cache@v3
with:
path: ./mdbook-linkcheck
key: mdbook-linkcheck-${{ env.MDBOOK-LINKCHECK-VERSION }}
- name: Install mdbook-linkcheck
if: steps.cache-mdbook-linkcheck.outputs.cache-hit != 'true'
run: |
mkdir mdbook-linkcheck && cd "$_"
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${{ env.MDBOOK-LINKCHECK-VERSION }}/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip
unzip mdbook-linkcheck.zip
chmod +x mdbook-linkcheck
- name: Update PATH
run: |
echo `pwd`/mdbook >> $GITHUB_PATH
echo `pwd`/mdbook-pagetoc >> $GITHUB_PATH
echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH
- name: Build Book
run: mdbook build
working-directory: ./website
- name: Store HTML
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: book
path: ./website/book
sitemap:
if: ${{ github.ref == 'refs/heads/main' }}
name: Generate Sitemap
needs: build
runs-on: ubuntu-latest
env:
STATIC-SITEMAP-CLI-VERSION: 2.1.2
steps:
- name: Download HTML
uses: actions/download-artifact@v3
with:
name: book
path: ./book
# Unsure how to cache NPM
- name: Install Static Sitemap CLI
run: |
npm install npx
npm install static-sitemap-cli@${{ env.STATIC-SITEMAP-CLI-VERSION }}
- name: Generate Sitemap
run: |
cd ./book/html
npx sscli --base https://neovide.dev
- name: Store Sitemap
uses: actions/upload-artifact@v3
with:
name: sitemap
path: ./book/html/sitemap.xml
publish:
if: ${{ github.ref == 'refs/heads/main' }}
name: Publish Website
needs: sitemap
runs-on: ubuntu-latest
steps:
- name: Download HTML & Sitemap
uses: actions/download-artifact@v3
- name: Move Sitemap Into HTML
run: mv ./sitemap/sitemap.xml ./book/html
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/html