From 28e13f173fb1fea6b4df10420330484160423862 Mon Sep 17 00:00:00 2001 From: Ben Robson Date: Thu, 25 Sep 2025 11:11:54 +1000 Subject: [PATCH] Update generate_documentation.yml --- .github/workflows/generate_documentation.yml | 52 +++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/generate_documentation.yml b/.github/workflows/generate_documentation.yml index 6c6b12b..4d33d7d 100644 --- a/.github/workflows/generate_documentation.yml +++ b/.github/workflows/generate_documentation.yml @@ -1,53 +1,67 @@ -# This workflow will generate the documentation for zander-docs dynamically - -name: Generate documentation +name: Generate Documentation on: push: branches: [master] pull_request: branches: [master] - - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] # Easily add more versions if needed steps: - - uses: actions/checkout@v2 + - name: Checkout Repository + uses: actions/checkout@v3 with: submodules: recursive - + token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Python 3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.10" - - name: Install dependencies + - name: Install Python dependencies run: | python -m pip install --upgrade pip - python -m pip install -r requirements.txt + if [ -f requirements.txt ]; then + python -m pip install -r requirements.txt + else + echo "No requirements.txt found, skipping Python dependency install." + fi - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + - name: Set up Node.js + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "npm" + cache: npm - name: Generate API documentation run: | - cd vendor - python APIGenerator/src/gen.py --build + if [ -d vendor ]; then + cd vendor + python APIGenerator/src/gen.py --build + else + echo "⚠️ Vendor folder not found. Skipping API generation." + fi - - name: npm install and build + - name: Install and Build with npm run: | - npm ci + if [ -f package-lock.json ]; then + npm ci + else + npm install + fi npm run build --if-present - name: Deploy 🚀 + if: success() # only deploy if build succeeds uses: JamesIves/github-pages-deploy-action@v4.2.3 with: - branch: gh-pages # The branch the action should deploy to. - folder: build # The folder the action should deploy. + branch: gh-pages + folder: build