@@ -2,72 +2,98 @@ name: GH Pages build
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - master
5
+ branches :
6
+ - " master"
7
+ - " main"
8
+ pull_request :
9
+ branches :
10
+ - " master"
11
+ - " main"
7
12
workflow_dispatch :
8
-
9
- # on:
10
- # push:
11
- # branches:
12
- # - "master"
13
- # - "main"
14
- # pull_request:
15
- # branches:
16
- # - "master"
17
- # - "main"
18
- # workflow_dispatch:
13
+
14
+ env :
15
+ # Increase this value to reset cache if etc/example-environment.yml has not changed
16
+ CACHE_NUMBER : 1
19
17
20
18
jobs :
21
19
build :
22
-
23
- runs-on : ubuntu-latest
20
+ strategy :
21
+ matrix :
22
+ include :
23
+ - os : ubuntu-latest
24
+ label : linux-64
25
+ prefix : /usr/share/miniconda3/envs/fep
26
+ name : ${{ matrix.label }}
27
+ runs-on : ${{ matrix.os }}
24
28
25
29
steps :
26
- - uses : actions/checkout@v1
27
- # Standard drop-in approach that should work for most people.
28
- - uses : ammaraskar/sphinx-action@master
29
- with :
30
- pre-build-command : " pip install sphinx_rtd_theme"
31
- docs-folder : " docs/"
30
+ - uses : actions/checkout@v3
31
+
32
+ - name : Setup Mambaforge
33
+ uses : conda-incubator/setup-miniconda@v2
34
+ with :
35
+ miniforge-variant : Mambaforge
36
+ miniforge-version : latest
37
+ activate-environment : fep
38
+ auto-activate-base : false
39
+ use-mamba : true
40
+ - name : Set cache date
41
+ run : echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
32
42
33
- # Example of using a custom build-command.
34
- # - uses: ammaraskar/sphinx-action@master
35
- # with:
36
- # build-command: "sphinx-build -b html . _build"
37
- # docs-folder: "docs2/"
38
- # Grabbing custom dependencies and building as a pdf.
39
- # - uses: ammaraskar/sphinx-action@master
40
- # with:
41
- # pre-build-command: "apt-get update -y && apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended"
42
- # build-command: "make latexpdf"
43
- # docs-folder: "docs2/"
44
- # Great extra actions to compose with:
45
- # Create an artifact of the html output.
46
- - uses : actions/upload-artifact@v1
47
- with :
48
- name : DocumentationHTML
49
- path : docs/_build/html/
50
- # Create an artifact out of the previously built pdf.
51
- # - uses: actions/upload-artifact@v1
52
- # with:
53
- # name: Documentation
54
- # path: docs2/_build/latex/pdfexample.pdf
55
- # Publish built docs to gh-pages branch.
56
- # ===============================
57
- - name : Commit documentation changes
58
- run : |
59
- git clone https://github.com/JohannesKarwou/transformato.git --branch gh-pages --single-branch gh-pages
60
- cp -r docs/_build/html/* gh-pages/
61
- cd gh-pages
62
- touch .nojekyll
63
- git config --local user.email "[email protected] "
64
- git config --local user.name "GitHub Action"
65
- git add .
66
- git commit -m "Update documentation" -a || true
67
- # The above command will fail if no changes were present, so we ignore
68
- # that.
69
- - name : Push changes
70
- uses : ad-m/github-push-action@master
71
- with :
72
- branch : gh-pages
73
- directory : gh-pages
43
+ - uses : actions/cache@v2
44
+ with :
45
+ path : ${{ matrix.prefix }}
46
+ key : ${{ matrix.label }}-conda-${{ hashFiles('devtools/conda-envs/fep_env.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
47
+ id : cache
48
+ - name : Update environment
49
+ run : mamba env update -n fep -f devtools/conda-envs/fep_env.yaml
50
+ if : steps.cache.outputs.cache-hit != 'true'
51
+
52
+ # - name: Cache conda
53
+ # uses: actions/cache@v2
54
+ # with:
55
+ # path: ~/conda_pkgs_dir
56
+ # key:
57
+ # ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
58
+ # hashFiles('docs/requirements.yaml') }}
59
+ # - name: Create conda env
60
+ # # # More info on options: https://github.com/conda-incubator/setup-miniconda
61
+ # uses: conda-incubator/setup-miniconda@v2
62
+ # with:
63
+ # python-version: ${{ matrix.python-version }}
64
+ # environment-file: docs/requirements.yaml
65
+ # channels: conda-forge,defaults
66
+ # activate-environment: docs
67
+ # # auto-update-conda: false
68
+ # # auto-activate-base: false
69
+ # show-channel-urls: true
70
+ # use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
71
+ - name : Run sphinx
72
+ shell : bash -l {0}
73
+ run : |
74
+ pip install sphinx sphinx_rtd_theme
75
+ sphinx-build docs docs/_build/html/
76
+ # Create an artifact of the html output.
77
+ - uses : actions/upload-artifact@v1
78
+ with :
79
+ name : DocumentationHTML
80
+ path : docs/_build/html/
81
+ # Publish built docs to gh-pages branch.
82
+ # ===============================
83
+ - name : Commit documentation changes
84
+ run : |
85
+ git clone https://github.com/wiederm/transformato.git --branch gh-pages --single-branch gh-pages
86
+ cp -r docs/_build/html/* gh-pages/
87
+ cd gh-pages
88
+ touch .nojekyll
89
+ git config --local user.email "[email protected] "
90
+ git config --local user.name "GitHub Action"
91
+ git add .
92
+ git commit -m "Update documentation" -a || true
93
+ # The above command will fail if no changes were present, so we ignore
94
+ # that.
95
+ - name : Push changes
96
+ uses : ad-m/github-push-action@master
97
+ with :
98
+ branch : gh-pages
99
+ directory : gh-pages
0 commit comments