|
1 | | -# This workflow will generate the documentation for zander-docs dynamically |
2 | | - |
3 | | -name: Generate documentation |
| 1 | +name: Generate Documentation |
4 | 2 |
|
5 | 3 | on: |
6 | 4 | push: |
7 | 5 | branches: [master] |
8 | 6 | pull_request: |
9 | 7 | branches: [master] |
10 | | - |
11 | | - # Allows you to run this workflow manually from the Actions tab |
12 | 8 | workflow_dispatch: |
13 | 9 |
|
14 | 10 | jobs: |
15 | 11 | build: |
16 | 12 | runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + node-version: [18] # Easily add more versions if needed |
17 | 16 |
|
18 | 17 | steps: |
19 | | - - uses: actions/checkout@v2 |
| 18 | + - name: Checkout Repository |
| 19 | + uses: actions/checkout@v3 |
20 | 20 | with: |
21 | 21 | submodules: recursive |
22 | | - |
| 22 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + |
23 | 24 | - name: Set up Python 3.10 |
24 | | - uses: actions/setup-python@v2 |
| 25 | + uses: actions/setup-python@v4 |
25 | 26 | with: |
26 | 27 | python-version: "3.10" |
27 | 28 |
|
28 | | - - name: Install dependencies |
| 29 | + - name: Install Python dependencies |
29 | 30 | run: | |
30 | 31 | 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 |
32 | 37 |
|
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 |
35 | 40 | with: |
36 | 41 | node-version: ${{ matrix.node-version }} |
37 | | - cache: "npm" |
| 42 | + cache: npm |
38 | 43 |
|
39 | 44 | - name: Generate API documentation |
40 | 45 | 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 |
43 | 52 |
|
44 | | - - name: npm install and build |
| 53 | + - name: Install and Build with npm |
45 | 54 | run: | |
46 | | - npm ci |
| 55 | + if [ -f package-lock.json ]; then |
| 56 | + npm ci |
| 57 | + else |
| 58 | + npm install |
| 59 | + fi |
47 | 60 | npm run build --if-present |
48 | 61 |
|
49 | 62 | - name: Deploy 🚀 |
| 63 | + if: success() # only deploy if build succeeds |
50 | 64 | uses: JamesIves/github-pages-deploy-action@v4.2.3 |
51 | 65 | 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