-
Notifications
You must be signed in to change notification settings - Fork 43
73 lines (62 loc) · 1.75 KB
/
auto_deploy_docs_pypi_onrelease.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
name: (Auto-On-Release) Deploy Docs and PyPI
on:
release:
types: [published]
jobs:
# Job (1): Build and deploy docs.
docs:
name: Build docs and auto-examples
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Download and setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: 3.8
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Dependencies
run: |
conda activate test
conda env list
pip install -r requirements-dev.txt
pip install -r optional-dependencies.txt
- name: Build docs
run: |
cd docs
make clean
make html
touch _build/html/.nojekyll
echo 'nltools.org' > _build/html/CNAME
- name: Deploy docs
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs/_build/html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Job (2): Build package and upload to pypi
deploy:
name: Build & deploy package
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Pypa build
run: |
python3 -m pip install build --user
- name: Wheel and source build
run: |
python3 -m build --sdist --wheel --outdir dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}