-
Notifications
You must be signed in to change notification settings - Fork 91
80 lines (66 loc) · 1.96 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 and Deploy website
on:
pull_request:
push:
branches:
- main
jobs:
# =============
# Build website
# =============
build:
runs-on: ubuntu-latest
env:
PYTHON: "3.9"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: List installed packages
run: pip list
- name: Build the website
run: make html
# Store the docs as a build artifact so we can deploy it later
- name: Upload HTML documentation as an artifact
uses: actions/upload-artifact@v4
with:
name: docs-${{ github.sha }}
path: _build/html
# ==============
# Deploy website
# ==============
deploy:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'geoscixyz/gpg' && github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
# Fetch the built docs from the "build" job
- name: Download HTML documentation artifact
uses: actions/download-artifact@v4
with:
name: docs-${{ github.sha }}
path: _build/html
- name: Deploy website
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html
publish_branch: gh-pages
cname: gpg.geosci.xyz
force_orphan: true
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"