-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (79 loc) · 2.59 KB
/
cd.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
name: continuous deployment
on:
pull_request:
branches:
- develop
- main
push:
branches:
- develop
- main
release:
jobs:
# deploy docs for develop and main branches
deploy-docs:
runs-on: ubuntu-latest
steps:
# setup, checkout pull_request.head.ref for repo-vis
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
- name: setup-python
uses: actions/setup-python@v3
# # update repo visualization for docs
# - name: repo-visualizer
# uses: githubocto/[email protected]
# with:
# output_file: docs/reference/apidoc/code_visualization.svg
# excluded_paths: ".github"
# commit_message: "repo-visualizer [skip actions]"
# install project, which is required for autodoc of code
- name: install buildingmotif
run: pip install .
# install jupyter-book, which for some reason isn't available with poetry install
- name: install jupyter book
run: pip install jupyter-book
# build docs, which are deployed by repo settings
- name: build docs
run: |
jupyter-book config sphinx ./docs/
sphinx-build ./docs/ docs/_build/html -b html
# TODO can we use an official GitHub Action? https://github.com/actions/deploy-pages
- name: deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
# deploy distribution if a new release and tag are created
deploy-dist:
needs: deploy-docs
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
# setup
- name: checkout
uses: actions/checkout@v3
- name: setup-python
uses: actions/setup-python@v3
# install poetry and build dist
- name: install-poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-in-project: false
virtualenvs-path: ~/.virtualenvs
- name: build dist
run: poetry build
- name: publish distribution to Test PyPI
id: test-pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: publish distribution to PyPI
if: steps.test-pypi.outcome == 'success'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}