Skip to content

Add OpenShell middleware project initializer #76

Add OpenShell middleware project initializer

Add OpenShell middleware project initializer #76

Workflow file for this run

name: Docs
"on":
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
renderer-tests:
name: Test Dev Notes renderer (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run renderer tests
run: python -m unittest discover -s tests
validate:
name: Validate documentation
needs: renderer-tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
cache-dependency-path: requirements-docs.txt
- name: Check Dev Notes renderer syntax
run: python -m py_compile scripts/render-dev-notes.py
- name: Check navigation JavaScript syntax
run: node --check docs/javascripts/navigation-drawer.js
- name: Build documentation
run: scripts/build-docs.sh
- name: Verify generated documentation is committed
run: git diff --exit-code -- docs/dev-notes zensical.toml
- name: Upload production documentation
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@v7
with:
name: production-docs-${{ github.run_id }}
path: site
if-no-files-found: error
retention-days: 1
deploy:
name: Deploy documentation
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
needs: validate
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: github-pages
queue: max
steps:
- name: Check production revision is current
id: freshness
uses: actions/github-script@v8
with:
script: |
const { data: branch } = await github.rest.repos.getBranch({
owner: context.repo.owner,
repo: context.repo.repo,
branch: 'main',
});
const current = branch.commit.sha === context.sha;
core.setOutput('current', String(current));
if (!current) {
core.notice(`Skipping stale production revision ${context.sha}.`);
}
- name: Checkout deployment tooling context
if: steps.freshness.outputs.current == 'true'
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Download production documentation
if: steps.freshness.outputs.current == 'true'
uses: actions/download-artifact@v8
with:
name: production-docs-${{ github.run_id }}
path: site
- name: Update composite Pages branch
if: steps.freshness.outputs.current == 'true'
uses: JamesIves/github-pages-deploy-action@4a3abc783e1a24aeb44c16e869ad83caf6b4cc23 # v4.7.4
with:
branch: gh-pages
folder: site
clean-exclude: pr-preview
force: false
attempt-limit: 10
- name: Checkout composite Pages site
if: steps.freshness.outputs.current == 'true'
uses: actions/checkout@v7
with:
ref: gh-pages
path: published-site
persist-credentials: false
- name: Upload Pages artifact
if: steps.freshness.outputs.current == 'true'
uses: actions/upload-pages-artifact@v5
with:
path: published-site
- name: Deploy to GitHub Pages
if: steps.freshness.outputs.current == 'true'
id: deployment
uses: actions/deploy-pages@v5