Skip to content

Add DITA Bootstrap Lunr Search plug-in #124

Add DITA Bootstrap Lunr Search plug-in

Add DITA Bootstrap Lunr Search plug-in #124

name: DITA Workflow
on:
push:
branches:
- dita
jobs:
build-html:
name: Generate html5 with latest DITA Open Toolkit # Human-readable job name
runs-on: ubuntu-latest
steps:
- name: Check out the dita branch
uses: actions/checkout@v4
with:
ref: dita
- name: Delete out folder
run: |
echo "Deleting out folder"
rm -rf out
- name: Build HTML5
uses: dita-ot/dita-ot-action@master
with:
build: |
set -e
dita install https://github.com/jason-fox/fox.jason.extend.css/archive/master.zip
dita install https://github.com/infotexture/dita-bootstrap/archive/master.zip
dita install https://github.com/infotexture/dita-bootstrap.lunr/archive/master.zip
dita --input=$(pwd)/dita/orange-heart-master.ditamap --format=html5 --verbose --propertyfile=$(pwd)/dita/build.properties -Dargs.input.dir=$(pwd)/dita 2>&1 | tee log.txt
- name: Upload log file as an artifact
uses: actions/upload-artifact@v4
with:
name: build-log-html5-txt
path: log.txt
- name: Archive the 'out' folder
run: |
set -e
tar -czf out.tar.gz out
- name: Upload 'out' folder archive
uses: actions/upload-artifact@v4
with:
name: out-html5-archive
path: out.tar.gz
- name: List build output
run: ls -R out
- name: Configure git
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Commit and push changes
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git add out
if git diff-index --quiet HEAD; then
echo "No changes to commit"
else
git commit -m "Github workflow ran DITA OT and generated html5 to out folder"
git push https://${{ secrets.GH_TOKEN }}@github.com/yetessam/orange-heart-image-addressing.git dita
fi
- name: Summarize build
run: |
echo "### Summary " >> $GITHUB_STEP_SUMMARY
echo "$(cat log.txt)" >> $GITHUB_STEP_SUMMARY
switch-branch:
name: Switch to Dev Branch and Configure HTML # Human-readable name for the job
runs-on: ubuntu-latest
needs: build-html # Indicates that this job depends on the build-html job
steps:
- name: Check out the dev branch
uses: actions/checkout@v4
with:
ref: dev
- name: Download 'out-html5-archive' artifact
uses: actions/download-artifact@v4
with:
name: out-html5-archive
path: .
- name: Extract the 'out' folder
run: |
tar -xzf out.tar.gz
ls -laR
- name: Create src folder if it doesn't exist
run: |
mkdir -p ./src
ls -la
- name: Python
run: | # Come back here
echo "Installing Python and dependencies"
- name: Install Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies and run Python script
run: |
set -e
echo "Listing contents of $(pwd):"
ls -laR
python -m venv venv
source venv/bin/activate
pip install beautifulsoup4
python python/orchestrate_html.py
echo "Listing contents of $(pwd):"
ls -laR
- name: Run Python script
run: |
set -e
source venv/bin/activate
python python/orchestrate_html.py
# For now, see if we can have Python process everything in the out folder
# Copying HTML over should happen after the Python code runs
- name: List directory contents after running Python script
run: |
set -e
echo "Listing contents of $(pwd):"
ls -l
echo "Contents of src directory:"
ls -la src
- name: Remove venv, tar file and out folder
run: |
rm -rf venv/
rm -f out.tar.gz
rm -rf out/
echo "Deleting out folder and out.tar.gz file"
- name: Commit and push changes to dev branch
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git add --verbose --force src
git commit -m "Copy files from DITA OT build to src "
git push origin dev