-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (65 loc) · 1.99 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
78
79
name: deploy
on:
push:
branches: [main, rc]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
jobs:
deploy-docs:
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
sudo apt-get install -y pandoc
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools_scm wheel
python -m pip install -e .[dev,docs]
- name: Build
run: |
sphinx-build docs docs_build
# Generated documents are push to `gh-pages` branch
# `ACTIONS_DEPLOY_KEY` is set by following: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-create-ssh-deploy-key
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs_build
deploy-pypi:
runs-on: ubuntu-latest
needs:
- deploy-docs
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Build
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools_scm wheel build
python -m build
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
verbose: true
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true