-
Notifications
You must be signed in to change notification settings - Fork 11
77 lines (67 loc) · 2.26 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
72
73
74
75
76
77
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:
permissions:
contents: write
id-token: write
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
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
# 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:
tag_name: ${{ github.ref }}
name: ${{ env.tag }}
files: |
dist/*
generate_release_notes: true