-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (69 loc) · 2.33 KB
/
documentation.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: Build and deploy documentation
on:
push:
tags-ignore:
- "*"
branches:
- "*"
release:
types: [released]
jobs:
DeployDocumentation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.3.2"
- name: Install dependencies
run: poetry install
- name: Build HTTP documentation
run: npx @redocly/cli build-docs http-api.yml --output docs/http-api.html
- name: Build python reference
run: |
poetry run pdocs as_markdown blueye.sdk -o docs/reference
rm docs/reference/blueye/sdk/index.md
- name: Build documentation
run: poetry run mkdocs build
- uses: actions/upload-artifact@v3
with:
name: docs
path: site
- name: Setup git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Pull gh-pages
run: |
git fetch origin gh-pages --depth=1
git checkout gh-pages
git pull origin gh-pages --depth=1
git checkout -
- name: Set variables
run: |
full_version="v$(cut -d ' ' -f 2 <<< "$(poetry version)")"
major_minor="$(cut -d '.' -f 1 <<< "$full_version")"."$(cut -d '.' -f 2 <<< "$full_version")"
echo "full_version=$full_version" >> $GITHUB_ENV
echo "major_minor=$major_minor" >> $GITHUB_ENV
- name: Deploy master
if: github.ref == 'refs/heads/master'
run: |
poetry run mike deploy dev
- name: Deploy release
if: ${{ github.event_name == 'release' }}
run: |
poetry run mike deploy --title ${{ env.full_version }} --update-aliases ${{ env.major_minor }} latest
- name: Checkout gh-pages branch
run: git checkout gh-pages
- name: Push to gh-pages
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GIT_TOKEN }}
branch: gh-pages