forked from ExeClim/Isca
-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (74 loc) · 2.25 KB
/
docs.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
name: docs
on:
push:
branches: [ master ]
paths:
- '.github/workflows/docs.yml'
- 'docs/**'
- 'src/**'
env:
GFDL_BASE: ${{ github.workspace }}
GFDL_ENV: "ubuntu_conda"
GFDL_WORK: "$HOME/gfdl_work"
GFDL_DATA: "$HOME/gfdl_data"
GFDL_PYDIR: "${{ github.workspace }}/src/extra/python"
jobs:
docs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9']
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0
# - name: Check environment variables
# run: |
# echo "Testing"
# echo $PWD
# echo $GFDL_BASE
# echo $GFDL_PYDIR
# echo $GITHUB_WORKSPACE
# echo $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: docs/environment.yml
miniforge-variant: Mambaforge
miniforge-version: "latest"
use-mamba: true
activate-environment: isca_docs
auto-activate-base: false
- name: List installed packages
shell: bash -l {0}
run: conda list
- name: Install
shell: bash -l {0}
run: |
cd $GFDL_PYDIR
python -m pip install -e .
cd $GFDL_BASE
- name: Build docs
shell: bash -l {0}
run: |
cd docs/
make html -e
- name: Commit documentation changes
run: |
git clone https://github.com/$GITHUB_REPOSITORY.git --branch gh-pages --single-branch gh-pages
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore that.
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}