-
Notifications
You must be signed in to change notification settings - Fork 360
89 lines (74 loc) · 2.76 KB
/
eamxx-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
# This workflow aims to automatically rebuild eamxx documentation
# every time the master branch is updated on github and within every PR
name: EAMxx Docs
on:
# Runs every time master branch is updated
push:
branches: [ master ]
# Only if docs-related files are touched
paths:
- components/eamxx/mkdocs.yml
- components/eamxx/docs/**
- components/eamxx/cime_config/namelist_defaults_scream.xml
# Runs every time a PR is open against master
pull_request:
branches: [ master ]
# Only if docs-related files are touched
paths:
- components/eamxx/mkdocs.yml
- components/eamxx/docs/**
- components/eamxx/cime_config/namelist_defaults_scream.xml
label:
types:
- created
workflow_dispatch:
concurrency:
# Prevent 2+ copies of this workflow from running concurrently
group: eamxx-docs-action
jobs:
eamxx-docs:
if: ${{ github.event.repository.name == 'scream' }}
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
# TODO: git rid of dependency on CIME
# TODO: another option to investigate is a sparse checkout.
# In the scream repo, all other components do not need to be checked out.
# And even in the upstream, we mainly need only components/xyz/docs (and a few more places).
submodules: true
- name: Show action trigger
run: |
echo "= The job was automatically triggered by a ${{github.event_name}} event."
- name: Set up Python 3.10
uses: actions/[email protected]
with:
python-version: "3.10"
- name: Install Python deps
run: |
pip install mkdocs pymdown-extensions mkdocs-material mdutils
- name: Generate EAMxx params docs
working-directory: components/eamxx/scripts
run: |
./eamxx-params-docs-autogen
- name: Build docs
working-directory: components/eamxx
run: |
mkdocs build --strict --verbose
# only deploy to the main github page when there is a push to master
- if: ${{ github.event_name == 'push' }}
name: GitHub Pages action
uses: JamesIves/github-pages-deploy-action@v4
with:
# Do not remove existing pr-preview pages
clean-exclude: pr-preview
folder: ./components/eamxx/site
# If it's a PR from within the same repo, deploy to a preview page
- if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
name: Preview docs
uses: rossjrw/pr-preview-action@v1
with:
source-dir: components/eamxx/site/