forked from oqc-community/qat
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.37 KB
/
publish.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
80
81
82
83
84
85
name: publish sphinx pages
on:
push:
tags:
- "*"
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
environment: "applications - github"
steps:
- name: Checkout
uses: actions/checkout@v3.5.2
- name: Setup Python
uses: actions/setup-python@v4.6.0
- name: cache poetry install
uses: actions/cache@v2
with:
key: poetry-1.4.1-0
path: ~/.local
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.3
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root --with docs
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Build docs
if: github.ref_type == 'branch'
run: |
git config --global user.email "GithubActions@oqc-community.com"
git config --global user.name "Github Actions"
git fetch --all
git checkout ${{ steps.extract_branch.outputs.branch }}
rm -rf .gitignore
poetry run sphinx-apidoc -f -M -e -o docs/source/ src/QAT "**/tests/**"
git add .
git commit -m "temporarily commiting api docs"
poetry run sphinx-multiversion docs/source/ docs/build/
- name: Extract tag name
if: github.ref_type == 'tag'
run: echo "tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/tags/}}" >> $GITHUB_OUTPUT
id: extract_tag
- name: Build docs - tag
if: github.ref_type == 'tag'
run: |
git config --global user.email "GithubActions@oqc-community.com"
git config --global user.name "Github Actions"
git fetch --all
git checkout ${{ steps.extract_branch.outputs.branch }} -b ${{ steps.extract_tag.outputs.tag }}
rm -rf .gitignore
poetry run sphinx-apidoc -f -M -e -o docs/source/ src/QAT "**/tests/**"
git add --force .
git commit -a -m "temporarily commiting api docs"
poetry run sphinx-multiversion docs/source/ docs/build/
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build
clean: false