Merge pull request #16 from legoeruro/main #22
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Deploy static content to Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: | |
- main | |
paths: | |
- 'python/**' | |
- '.github/workflows/website.yml' | |
- 'website/**' | |
- 'unity/**' | |
# Alternative: only build for tags. | |
# tags: | |
# - '*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# security: restrict permissions for CI jobs. | |
permissions: | |
contents: read | |
jobs: | |
build-client-docs-as-artifact: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install docfx | |
run: dotnet tool install -g docfx | |
- name: Run script to build the documentation | |
working-directory: ./unity/Documentation | |
run: ./scripts/build.cmd | |
# - name: Move docs to website directory | |
# run: | | |
# mkdir -p ./website/docs/client/ | |
# cp -r ./unity/Documentation/clientHTMLOutput/* ./website/docs/client/ | |
# Upload the website directory as an artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: client-docs | |
path: ./unity/Documentation/clientHTMLOutput | |
build-server-docs: | |
needs: build-client-docs-as-artifact | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.12' | |
- name: Install Poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: '1.8.3' | |
- name: Setup a local virtual environment (if no poetry.toml file) | |
working-directory: ./python | |
run: | | |
poetry config virtualenvs.create true --local | |
poetry config virtualenvs.in-project true --local | |
- name: Define a cache for the virtual environment based on the dependencies lock file | |
uses: actions/cache@v3 | |
with: | |
path: ./python/.venv | |
key: venv-${{ hashFiles('./python/poetry.lock') }} | |
- name: Install docs dependencies | |
working-directory: ./python | |
run: poetry install --with docs | |
- name: Build the documentation | |
working-directory: ./python | |
run: poetry run python tools/make_docs_cli.py | |
- name: Move docs to website directory | |
run: | | |
mkdir -p ./website/docs/server/ | |
cp -r ./python/docs/* ./website/docs/server/ | |
# Get client docs to use as part of pages artifact | |
- uses: actions/download-artifact@v4 | |
with: | |
name: client-docs | |
path: ./website/docs/client | |
# # cleanup client docs artifacts | |
# - name: Delete client docs artifact | |
# run: | | |
# github.rest.actions.deleteArtifact({ | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# artifact_id: ${{ steps.artifact-download.outputs.artifact-id }} | |
# }); | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./website | |
# Single deploy job since we're just deploying | |
deploy: | |
needs: build-server-docs | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |