Skip to content

Merge pull request #1 from mit-ll/dependabot/pip/certifi-2024.7.4 #5

Merge pull request #1 from mit-ll/dependabot/pip/certifi-2024.7.4

Merge pull request #1 from mit-ll/dependabot/pip/certifi-2024.7.4 #5

Workflow file for this run

##########################################################################################
# DESCRIPTION: Generate pdocs and pushes them to Git Pages.
# AUTHOR: W. Li
# VERSION: 1.0
# CREATED: 1/6/2024
#
# References:
# * https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-pythonCommon
#
##########################################################################################
name: pdocs
on:
push:
branches: ["main"]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
##########################################################################################
# Jobs
##########################################################################################
jobs:
########################################################################################
# Build the static HTML files we want to publish.
########################################################################################
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
# Checkout the source repo
- name: Checkout source
uses: actions/checkout@v4
# Setup the environment with specified python version
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
token: ${{ secrets.GH_GITHUB_COM_TOKEN }}
python-version: "3.10"
# Install poetry and disable virtual environments
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
virtualenvs-in-project: false
installer-parallel: true
# Install nox
- name: Install dependencies
run: |
pip install nox
# Use nox to generate the document
- name: Generate pdoc artifact
run: |
mkdir -p save/pdocs
export PYTHONPATH=${{ github.workspace }}
nox -r -s pdoc
# Upload the artifact to the next job
- name: Upload pdoc artifact
uses: actions/upload-artifact@v3
with:
name: pdoc artifact
path: save
########################################################################################
# Deploy the static HTML files to Github Pages.
########################################################################################
deploy:
needs: [build]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# We first need to checkout the repo for the code.
- name: Checkout
uses: actions/checkout@v4
# Now download the artifact from the previous build for pdoc.
- name: Download pdoc artifact
uses: actions/download-artifact@v3
with:
name: pdoc artifact
path: save
# Now we need to replace the pdoc generated HTML files with the docs/ folder.
# Note: Github pages expects all of your HTML static files to reside in docs/
- run: |
echo "Verifying pdoc artifact was downloaded..."
echo "ls -al save/pdocs/"
ls -al save/pdocs
echo "Removing old docs folder..."
rm -rf docs
echo "Copying pdoc into docs folder..."
mv save/pdocs docs/
echo "Display what is in docs folder..."
ls -al docs
# We are now ready to upload the docs/ artifact folder to Github pages.
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
# Once the upload is complete we can deploy
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4