Skip to content

Publish Docs

Publish Docs #14

Workflow file for this run

name: Publish Docs
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'
permissions:
contents: read
jobs:
build_docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
cache-downloads: true
- name: Checkout mapflpy
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install nox[pbs]
- name: Set nox conda backend
run: echo "CONDA_EXE=micromamba" >> "$GITHUB_ENV"
- name: Build docs
run: |
nox -s build_docs
- name: Upload docs artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: docs
path: .nox/_artifacts/docs/html*/
retention-days: 7
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.DOCS_SSH_KEY }}
known_hosts: "placeholder"
- name: Add known_hosts from target
env:
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
run: |
mkdir -p ~/.ssh
ssh-keyscan -p "${SSH_PORT:-22}" -H "${SSH_HOST}" >> ~/.ssh/known_hosts
- name: Rsync to server
env:
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
SSH_USER: ${{ secrets.DOCS_SSH_USER }}
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
REMOTE_DIR: ${{ secrets.DOCS_SSH_PATH }}
run: |
# make sure remote dir exists
ssh -p "${SSH_PORT:-22}" "${SSH_USER}@${SSH_HOST}" "mkdir -p '${REMOTE_DIR}'"
rsync -rlvz \
--omit-dir-times --no-times \
--no-perms --no-owner --no-group \
-e "ssh -p ${SSH_PORT:-22}" \
.nox/_artifacts/docs/html*/ "${SSH_USER}@${SSH_HOST}:${REMOTE_DIR}/"