-
Notifications
You must be signed in to change notification settings - Fork 22
94 lines (77 loc) · 2.77 KB
/
cd.yml
File metadata and controls
94 lines (77 loc) · 2.77 KB
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
84
85
86
87
88
89
90
91
92
93
94
---
name: "Build and Deploy"
on:
workflow_dispatch:
push:
branches:
- "development"
tags:
- "v1.**"
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: "read"
id-token: "write"
pages: "write"
jobs:
build:
runs-on: "ubuntu-20.04"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v3"
with:
ref: "development"
# Required for sphinx-multiversion
- run: "git fetch --depth=1 origin '+refs/tags/*:refs/remotes/origin/*'"
- name: "Setup Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.6.15"
- name: "Install dependencies"
run: |
pip install poetry==1.2.0a2 poetry-dynamic-versioning==0.17.1
poetry install --with docs
- name: "Build docs"
run: "poetry run sphinx-multiversion docs docs/_build/html"
- name: "Copy the `development` branch docs to the landing page"
run: |
# With sphinxcontrib-versioning, we would generate a separate directory of docs
# for each version tag and branch, but also have the default branch's i.e. `development`
# docs at the top level.`sphinx-multiversion` only generates the separate
# directories. To avoid breaking links, we copy the the root ref docs (i.e.,
# the `development` branch docs) to the parent directory containing all docs.
cp -R "docs/_build/html/development/." docs/_build/html
- name: "Upload artifact"
uses: "actions/upload-pages-artifact@v1"
with:
path: "docs/_build/html"
deploy:
runs-on: "ubuntu-20.04"
environment:
name: "github-pages"
url: "${{ steps.deployment.outputs.page_url }}"
needs: "build"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v3"
- name: "Setup Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.6.15"
- name: "Install dependencies"
run: |
pip install poetry==1.2.0a2 poetry-dynamic-versioning==0.17.1
- name: "Deploy to TEST-PyPI"
if: "${{ github.ref_type == 'branch' }}"
run: >-
# Use the test-pypi index for the development branch
poetry config repositories.testpypi https://test.pypi.org/legacy/ &&
poetry publish --build -u __token__ -p ${{secrets.TESTPYPI_TOKEN }} -r testpypi
- name: "Deploy to PyPI"
if: "${{ github.ref_type == 'tag' }}"
run: |
poetry publish --build -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: "Deploy to GitHub Pages"
id: "deployment"
uses: "actions/deploy-pages@v1"