Juvix Docs CI #240
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Juvix Docs CI | |
"on": | |
workflow_dispatch: | |
inputs: | |
build-type: | |
type: choice | |
description: "Docs build type" | |
default: "dev" | |
options: | |
- "dev" | |
- "latest" | |
skip: | |
description: Skipped build tasks (comma-separated) e.g., check-format-juvix-files, typecheck-juvix-files | |
default: "" | |
required: false | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}" | |
cancel-in-progress: true | |
env: | |
GIT_COMMITTER_NAME: juvix-docs-ci | |
GIT_COMMITTER_EMAIL: [email protected] | |
SKIP: ${{ github.event.inputs.skip }} | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout our repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install the latest Juvix compiler (for latest build-type) | |
uses: jaxxstorm/[email protected] | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.build-type == 'latest' | |
with: | |
repo: anoma/juvix | |
tag: latest | |
chmod: 0755 | |
- name: See the dev version in the documentation | |
id: juvix-version | |
run: | | |
echo "number=$(cat VERSION)" >> "$GITHUB_OUTPUT" | |
- name: Install the corresponding Juvix compiler | |
uses: jaxxstorm/[email protected] | |
if: github.event_name != 'workflow_dispatch' || ( github.event_name != 'workflow_dispatch' || github.event.inputs.build-type == 'dev') | |
with: | |
repo: anoma/juvix | |
tag: v${{ steps.juvix-version.outputs.number }} | |
- name: See the exact version of the Juvix compiler installed | |
run: | | |
juvix --version | |
- uses: actions/cache@v3 | |
with: | |
key: ${{ github.ref }} | |
path: .cache | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11.1" | |
check-latest: true | |
cache: "pip" | |
- uses: pre-commit/[email protected] | |
- name: Generate HTML files from examples | |
run: | | |
make html-examples | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --user -r requirements.txt | |
- name: Build prerequisites | |
run: | | |
make pre-build | |
- name: Test building without material-insiders | |
run: | | |
MKDOCSCONFIG=mkdocs.yml make docs | |
- name: Setup Git | |
run: | | |
git config --global user.name "${GIT_COMMITTER_NAME}" | |
git config --global user.email "${GIT_COMMITTER_EMAIL}" | |
- name: Install material-insiders | |
if: >- | |
github.ref == 'refs/heads/main' | |
run: | | |
pip install --user -r insiders.requirements.txt | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Deploy documentation via GitHub (for releases) | |
if: >- | |
github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' | |
run: | | |
MKDOCSCONFIG=mkdocs.insiders.yml make ${{ github.event.inputs.build-type }} | |
env: | |
RUN_GITHUB_ACTION: ${{ secrets.RUN_GITHUB_ACTION }} | |
- name: By default, deploy DEV documentation via pushes to main | |
if: >- | |
github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch' | |
run: | | |
MKDOCSCONFIG=mkdocs.insiders.yml make dev | |
env: | |
RUN_GITHUB_ACTION: ${{ secrets.RUN_GITHUB_ACTION }} |