Skip to content

Merge pull request #164 #61

Merge pull request #164

Merge pull request #164 #61

Workflow file for this run

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