Skip to content
Merged

Dev #12

Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
74ee9b8
Update GitHub Actions workflows to use Python 3.8 and improve package…
Chivier Jan 18, 2025
3200d0d
Refactor GitHub Actions workflows to streamline Conda channel configu…
Chivier Jan 18, 2025
d6aca24
Refactor GitHub Actions workflows to enhance Conda environment setup …
Chivier Jan 18, 2025
f481622
Refactor GitHub Actions workflows to improve Conda environment initia…
Chivier Jan 18, 2025
d80b7e2
Refactor GitHub Actions workflow to replace Conda setup with Python 3…
Chivier Jan 18, 2025
dcd3707
Refactor GitHub Actions workflow to simplify event triggers and maint…
Chivier Jan 18, 2025
c2be708
Update GitHub Actions workflow to install the latest version of pando…
Chivier Jan 18, 2025
c43cca0
Update GitHub Actions workflow for D2l Test: rename workflow, add cac…
Chivier Jan 18, 2025
ce84bd0
Update GitHub Actions workflow to install the latest version of pando…
Chivier Jan 18, 2025
1dcfa53
Update GitHub Actions workflow to install sphinxcontrib-bibtex depend…
Chivier Jan 18, 2025
ae92064
Refactor GitHub Actions workflow to remove specific version installat…
Chivier Jan 18, 2025
b0c7cb8
Refactor GitHub Actions workflow to streamline the installation proce…
Chivier Jan 18, 2025
b428527
Refactor GitHub Actions workflow to enhance documentation build proce…
Chivier Jan 18, 2025
46f56b8
Enhance GitHub Actions workflow by adding push event trigger for the …
Chivier Jan 18, 2025
7ebf6b7
Refactor GitHub Actions workflow to simplify event triggers by consol…
Chivier Jan 18, 2025
35f761c
Merge branch 'master' into dev
Chivier Jan 18, 2025
196b77c
Refactor GitHub Actions workflow to simplify event triggers by consol…
Chivier Jan 18, 2025
9083600
Merge branch 'dev' of github.com:openmlsys/openmlsys-en into dev
Chivier Jan 18, 2025
c3889b2
Refactor GitHub Actions workflow to streamline the installation and d…
Chivier Jan 18, 2025
8f06cb1
Add D2l Test workflow for automated documentation build
Chivier Jan 18, 2025
4db48a5
Merge branch 'master' into dev
Chivier Jan 18, 2025
e76edc6
Refactor GitHub Actions workflow for documentation updates: streamlin…
Chivier Jan 18, 2025
5770d4a
Merge branch 'dev' of github.com:openmlsys/openmlsys-en into dev
Chivier Jan 18, 2025
da2b4cf
Update GitHub Actions workflow for documentation updates: configure G…
Chivier Jan 18, 2025
cbd7c64
Update GitHub Actions workflow to change default branch from 'master'…
Chivier Jan 18, 2025
80c39d2
Update GitHub Actions workflow to change commit author details for do…
Chivier Jan 18, 2025
c1a6e78
Update GitHub Actions workflow to use GitHub token for cloning and pu…
Chivier Jan 18, 2025
0d58d5f
Simplify GitHub Actions workflow for documentation updates
Chivier Jan 27, 2025
c682704
Fix GitHub Actions documentation update workflow push command
Chivier Jan 27, 2025
6538edf
Remove hardcoded Git user configuration in documentation update workflow
Chivier Jan 27, 2025
aeed6e5
Add explicit Git user configuration in documentation update workflow
Chivier Jan 27, 2025
3caad95
Add PAT token environment variable to documentation update workflow
Chivier Jan 27, 2025
d4d86b5
Merge branch 'master' into dev
Chivier Jan 27, 2025
e19fba5
Refactor documentation update workflow PAT token placement
Chivier Jan 27, 2025
8300833
Refactor documentation update workflow authentication and push mechanism
Chivier Jan 27, 2025
dbe7566
Streamline documentation update workflow authentication
Chivier Jan 27, 2025
8940abd
Improve GitHub Actions documentation update workflow authentication
Chivier Jan 27, 2025
032f95c
Update GitHub Actions documentation workflow authentication
Chivier Jan 27, 2025
759287a
Refactor and enhance documentation update GitHub Actions workflow
Chivier Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 70 additions & 34 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,99 @@
name: Update Docs

on:
- push
- pull_request
- workflow_dispatch
push:
branches:
- main # specify branches if needed
pull_request:
workflow_dispatch:

env:
PYTHON_VERSION: '3.8'
DEST_REPO: 'openmlsys/html-en'
GIT_USER_NAME: 'GitHub Actions Bot'
GIT_USER_EMAIL: 'github-actions[bot]@users.noreply.github.com'

jobs:
build:
build-and-deploy:
runs-on: ubuntu-20.04

steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v2

# Set up Python 3.8
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/checkout@v3 # Updated to v3
with:
python-version: '3.8'
fetch-depth: 0 # Fetch all history for better versioning

# Cache Python packages to speed up builds
- name: Cache Python packages
uses: actions/cache@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip' # Enable pip caching

# Install Pandoc using apt-get
- name: Install Pandoc
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pandoc

# Install Python dependencies and build the HTML documentation
- name: Install dependencies

- name: Setup Python virtual environment
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip

- name: Install Python dependencies
run: |
source venv/bin/activate
pip install -r requirements.txt
pip install sphinx-mathjax-offline

- name: Install d2l-book
run: |
source venv/bin/activate
git clone https://github.com/openmlsys/d2l-book.git
cd d2l-book
pip install .
cd ..

- name: Build documentation
run: |
source venv/bin/activate
sh build_html.sh

# Clone the html-en repository
- name: Clone html-en Repository
- name: Deploy to html-en repository
if: github.event_name != 'pull_request' # Don't deploy on PRs
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git clone https://github.com/openmlsys/html-en.git
cp -rf _build/html/* html-en/
# Clone the destination repository
git clone https://${GH_TOKEN}@github.com/${DEST_REPO}.git

# Copy built documentation
cp -r _build/html/* html-en/

# Configure git
cd html-en
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --quiet || git commit -m 'Update English docs'
git push || echo "No changes to push"
git config user.name "${GIT_USER_NAME}"
git config user.email "${GIT_USER_EMAIL}"

# Check if there are changes to commit
if [[ -n $(git status -s) ]]; then
git add .
git commit -m "docs: update documentation

Automated update by GitHub Actions
Workflow: ${{ github.workflow }}
Run ID: ${{ github.run_id }}
Triggered by: ${{ github.event_name }}"

# Push changes
git push origin main
else
echo "No changes to commit"
fi

- name: Clean up
if: always()
run: |
rm -rf venv
rm -rf html-en
rm -rf d2l-book