-
Notifications
You must be signed in to change notification settings - Fork 11
71 lines (61 loc) · 2.15 KB
/
deploy.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
name: deploy
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
concurrency:
group: deploy_docs
cancel-in-progress: true
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build-and-deploy-book:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
# Install dependencies
- name: Install dependencies
run: |
# Install Python dependencies
pip install --upgrade pip build .[doc]
# Build and install the theme package.
- name: Build and install theme
env:
ENV: prod
run: |
python -m build
pip install dist/napari_sphinx_theme*.whl
# Build the documentation.
- name: Build docs
env:
GOOGLE_CALENDAR_API_KEY: ${{ secrets.GOOGLE_CALENDAR_API_KEY }}
run: sphinx-build -b=html docs/ build/
# Deploy the book's HTML to github pages
- name: GitHub Pages action
if: github.repository == 'napari/napari-sphinx-theme' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
# If tagged version: Publish wheel to PyPI
- name: Publish to PyPI
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# If tagged version: Update release on github repo
- uses: softprops/action-gh-release@v1
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/tags')
with:
generate_release_notes: true