forked from WEC-Sim/WEC-Sim
-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (79 loc) · 2.33 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
name: Documentation
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: 1
jobs:
test:
name: Test the current branch
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: _wssphinx
environment-file: docs/environment.yml
python-version: '3.9'
auto-activate-base: false
- run: |
conda info
- name: Build docs
run: |
sphinx-build -W --keep-going -b html docs ${{ runner.temp }}
build:
name: Build all branches
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
lfs: 'true'
fetch-depth: 0
- name: Get branch name
run: |
branch=$(echo ${{ github.ref }} | sed 's:.*/::')
echo "BRANCH=$branch" >> $GITHUB_ENV
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: _wssphinx
environment-file: docs/environment.yml
python-version: '3.9'
auto-activate-base: false
- run: |
conda info
- name: Create build directory
run: echo "BUILD_DIR=$(mktemp -d -t pages-XXXXXXXXXX)" >> $GITHUB_ENV
- name: Build docs
run: |
sphinx-multiversion docs ${{ env.BUILD_DIR }}
touch ${{ env.BUILD_DIR }}/.nojekyll
cp docs/_assets/gh-pages.gitignore ${{ env.BUILD_DIR }}/.gitignore
cp docs/_assets/gh-pages-redirect.html ${{ env.BUILD_DIR }}/index.html
cp docs/_assets/gh-pages-readme.md ${{ env.BUILD_DIR }}/README.md
mkdir ${{ env.BUILD_DIR }}/master
cp docs/_assets/gh-pages-redirect.html ${{ env.BUILD_DIR }}/master/index.html
- name: Deploy
if: ${{ github.event_name == 'push' && (env.BRANCH == 'dev' || env.BRANCH == 'main') }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.BUILD_DIR }}
force_orphan: true