Skip to content

Commit 2d6af75

Browse files
authored
Merge pull request #27 from ModularSoftAU/benrobson-patch-1
Update generate_documentation.yml
2 parents 59bed9c + 28e13f1 commit 2d6af75

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed
Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,67 @@
1-
# This workflow will generate the documentation for zander-docs dynamically
2-
3-
name: Generate documentation
1+
name: Generate Documentation
42

53
on:
64
push:
75
branches: [master]
86
pull_request:
97
branches: [master]
10-
11-
# Allows you to run this workflow manually from the Actions tab
128
workflow_dispatch:
139

1410
jobs:
1511
build:
1612
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [18] # Easily add more versions if needed
1716

1817
steps:
19-
- uses: actions/checkout@v2
18+
- name: Checkout Repository
19+
uses: actions/checkout@v3
2020
with:
2121
submodules: recursive
22-
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
2324
- name: Set up Python 3.10
24-
uses: actions/setup-python@v2
25+
uses: actions/setup-python@v4
2526
with:
2627
python-version: "3.10"
2728

28-
- name: Install dependencies
29+
- name: Install Python dependencies
2930
run: |
3031
python -m pip install --upgrade pip
31-
python -m pip install -r requirements.txt
32+
if [ -f requirements.txt ]; then
33+
python -m pip install -r requirements.txt
34+
else
35+
echo "No requirements.txt found, skipping Python dependency install."
36+
fi
3237
33-
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v2
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v3
3540
with:
3641
node-version: ${{ matrix.node-version }}
37-
cache: "npm"
42+
cache: npm
3843

3944
- name: Generate API documentation
4045
run: |
41-
cd vendor
42-
python APIGenerator/src/gen.py --build
46+
if [ -d vendor ]; then
47+
cd vendor
48+
python APIGenerator/src/gen.py --build
49+
else
50+
echo "⚠️ Vendor folder not found. Skipping API generation."
51+
fi
4352
44-
- name: npm install and build
53+
- name: Install and Build with npm
4554
run: |
46-
npm ci
55+
if [ -f package-lock.json ]; then
56+
npm ci
57+
else
58+
npm install
59+
fi
4760
npm run build --if-present
4861
4962
- name: Deploy 🚀
63+
if: success() # only deploy if build succeeds
5064
uses: JamesIves/github-pages-deploy-action@v4.2.3
5165
with:
52-
branch: gh-pages # The branch the action should deploy to.
53-
folder: build # The folder the action should deploy.
66+
branch: gh-pages
67+
folder: build

0 commit comments

Comments
 (0)