-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (92 loc) · 2.91 KB
/
deploy_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
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Documentation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-deploy:
name: Build Documentation and Push
runs-on: ubuntu-latest
steps:
# https://github.com/marketplace/actions/checkout
- name: Start actions
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
# Cache Conda environment installation
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('environment.yml') }}
# Setting Up Cache pip installations
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Prepare Environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: gf
environment-file: environment.yml
# python-version: 3.8
auto-activate-base: false
use-only-tar-bz2: true
# To keep Conda activated you have to use 'shell: bash -l {0}' line
# To specifiy the shell
- name: INFO using bash shell
shell: bash -l {0}
run: |
conda info
conda list
# - name: Install lwsspy
# shell: bash -l {0}
# run: pip install -e .
# - name: Install Doc Reqs
# shell: bash -l {0}
# run: pip install -r docs/requirements.txt
- name: Make Docs
shell: bash -l {0}
run: |
cd docs/
make html
cd -
# Great extra actions to compose with:
# Create an artifact of the html output.
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: DocumentationHTML
path: docs/build/html/
- name: Commit documentation changes
shell: bash -l {0}
run: |
git clone https://github.com/lsawade/GF3D.git --branch gh-pages --single-branch gh-pages
rm -rf gh-pages/*
cp -r docs/build/html/* gh-pages/
cd gh-pages
touch .nojekyll
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# that.
# Push the changes
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}