-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (85 loc) · 3.37 KB
/
main.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Publish Docs
# on: workflow_dispatch
on:
push:
branches: [ main ]
# pull_request:
# branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
publish:
# The type of runner that the job will run on
strategy:
matrix:
# os: ["ubuntu-latest", "macos-latest"]
os: ["ubuntu-latest"]
# python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.9"]
runs-on: ${{ matrix.os }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout project
uses: actions/checkout@v2
#----------------------------------------------
#------- install & configure Python ---------
#----------------------------------------------
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry ---------
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install main (non-optional) and dev dependencies
# see [tool.poetry.dependencies] and [tool.poetry.dev-dependencies]
# in pyproject.toml
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install package
run: |
poetry install
poetry install --extras "docs"
#----------------------------------------------
# Build documentation
#----------------------------------------------
- name: Build doc
run: |
cd docs
poetry run make clean
poetry run make html
#----------------------------------------------
# deploy documentation
#----------------------------------------------
- name: Create .nojekyll file.
run: |
> docs/_build/html/.nojekyll
- name: Deploy documentation to gh-pages branch
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh-pages
FOLDER: docs/_build/html
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}