Update create_html_pages.yml #15
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
# Create updated html pages for documentation | |
name: Create HTML | |
on: | |
push: | |
branches: | |
- master | |
- feature/create-html-workflow | |
jobs: | |
run_tests: | |
name: Create HTML Pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb | |
- name: Start virtual frame buffer | |
run: | | |
export DISPLAY=:100 | |
echo "Starting virtual frame buffer..." | |
Xvfb -ac :100 -screen 0 1280x1024x24 > /dev/null & | |
- name: Debug Xvfb | |
run: | | |
export DISPLAY=:100 | |
- name: Set up Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' # Java distribution (e.g., 'adoptopenjdk', 'zulu') | |
- name: Install MATLAB | |
uses: matlab-actions/setup-matlab@v2 | |
with: | |
release: R2024a # R2020a This is necessary to create the pages for types | |
- name: Create pages | |
uses: matlab-actions/run-command@v2 | |
with: | |
startup-options: -batch | |
command: | | |
setenv('DISPLAY', ':100'); | |
addpath(genpath('tools')); | |
disp('Display environment:') | |
disp(getenv('DISPLAY')) | |
matnwb_exportTutorials(ExportFormat=".html",RunLivescript=false); | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Push to gh-pages | |
run: | | |
mkdir -p gh-pages/docs | |
cp -r docs/html gh-pages/docs/ | |
cd gh-pages | |
git config user.name "${{ github.workflow }} by ${{ github.actor }}" | |
git config user.email "<>" | |
# Only proceed with commit and push if changes are detected | |
if [[ $(git add . --dry-run | wc -l) -gt 0 ]]; then | |
git add . | |
git commit -m "Update html pages" | |
git push -f | |
else | |
echo "Nothing to commit" | |
fi |