-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (66 loc) · 1.99 KB
/
build.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
name: Build website
on:
# Build after every push to main
push:
branches:
- main
# Build on every PR
pull_request:
jobs:
# =================
# Build the website
# =================
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install MyST
run: |
npm install -g mystmd
- name: Print MyST version
run: myst --version
- name: Build website as static HTML
run: |
echo "Building MyST website using BASE_URL=" $BASE_URL
myst build --html
env:
BASE_URL: /${{ github.event.repository.name }}
# Store the website as a build artifact so we can deploy it later
- name: Upload HTML website as an artifact
# Only if not a pull request
if: success() && github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: html-${{ github.sha }}
path: _build/html
# ==================
# Deploy the website
# ==================
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request'
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Fetch the built HTML from the build job
- name: Download HTML artifact
uses: actions/download-artifact@v4
with:
name: html-${{ github.sha }}
path: _build/html
- name: Deploy to gh-pages
if: success() && github.event_name != 'pull_request'
# Don't use tags: https://julienrenaux.fr/2019/12/20/github-actions-security-risk/
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html
publish_branch: gh-pages
enable_jekyll: false
force_orphan: true