Skip to content

[docs] update docs.yml and docs workflow to support versioning #432

[docs] update docs.yml and docs workflow to support versioning

[docs] update docs.yml and docs workflow to support versioning #432

Workflow file for this run

name: Docs
#This workflow automates updating the dev version of the documentation website and the deployment of new versions of the document website.
on:
pull_request:
# Publish docs weekly
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:
inputs:
testing:
type: boolean
description: Is this a test run that will be built into gamma account?
default: false
required: false
version-number:
type: string
description: What is the new version number (ex. v0.28.0) for the website? If updating dev, leave this blank.
default: master
required: false
permissions:
id-token: write
contents: read
jobs:
documentation:
runs-on: ubuntu-latest
steps:
#Phase I: Set-up
#This phase sets up all of the necessary dependencies. This includes installing Java, Python, and adding the tools used to build the documentation website.
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 17
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python Dependencies
run: pip3 install nbconvert mkdocs==1.4.3 mkdocs-exclude mknotebooks mkdocs-material jupyter Pygments Markdown mike
- name: Install CN fonts
run: sudo apt-get update && sudo apt-get install fonts-arphic-uming
- name: Cache IJava Kernel
id: ijava-cache
uses: actions/cache@v4
with:
path: ~/.local/share/jupyter/kernels/java
key: ${{ runner.os }}-ijava-kernel
- name: Install IJava kernel
if: steps.ijava-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/frankfliu/IJava.git
cd IJava/
./gradlew installKernel
#Phase II: Consolidate the Source Files
#This phase consolidates all of the source files (i.e. Markdown files and Jupyter Notebooks) that are converted into the html files that form the documenetation website.
#These files are split across the DJL, DJL-Demo, and DJL-Serving Repository. They need to be consolidated locallay and inaccordance with paths specified in the mkdocs.yml file in djl/docs.
- name: Create website directory
run: |
cd /home/runner/work/djl
mkdir site
- name: Checkout DJL Repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.version-number }}
#This step is necessary because the index.html file in djl/index.html overwrites the index.html file Mike create for the landing page
#This is problematic because this index.html corresponds to the djl website rather than the docs website.
- name: Delete index.html
run: |
rm -f index.html
shell: bash
- name: Checkout DJL-Serving
uses: actions/checkout@v4
with:
repository: 'deepjavalibrary/djl-serving'
ref: ${{ github.event.inputs.version-number || 'master' }}
path: docs/serving
- name: Checkout DJL-Demo
uses: actions/checkout@v4
with:
repository: 'deepjavalibrary/djl-demo'
ref: ${{ github.event.inputs.version-number || 'master' }}
path: docs/demos
- name: Add mybinder link
run: |
python3 tools/scripts/add_online_runner.py
#Phase III: Retrive Current Website
#This phase handles authentication with AWS.
- name: Configure AWS Test Credentials
if: ${{ github.event.inputs.testing == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
aws-region: us-east-1
role-to-assume: arn:aws:iam::185921645874:role/UpdateWebsite
role-session-name: UpdateWebsite
- name: Configure Deployment AWS Credentials
if: ${{ github.event_name != 'pull_request' && github.event.inputs.testing != 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
#Phase IV: Build and Deploy New Website
- name: Build New Version
env:
TESTING_FLAG: ${{ github.event.inputs.testing }}
run: |
echo "Building Website"
chmod +x build-website.sh
./build-website.sh -t "$TESTING_FLAG" -v "${{ github.event.inputs.version-number }}"