|
1 | | -name: docs |
| 1 | +name: Build and deploy |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: ["main"] |
6 | 6 | pull_request: |
7 | 7 | branches: ["main"] |
8 | 8 |
|
| 9 | + # Re-run every Tuesday at 6AM |
| 10 | + # schedule: |
| 11 | + # - cron: "0 6 * * 2" |
| 12 | + |
| 13 | + # Re-run on demand: |
| 14 | + workflow_dispatch: |
| 15 | + |
9 | 16 | jobs: |
10 | 17 |
|
11 | | - mkdocs-link-check: |
12 | | - runs-on: ubuntu-22.04 |
13 | | - steps: |
14 | | - - uses: actions/checkout@v4 |
15 | | - - name: mkdocs-link-check (soft) |
16 | | - uses: byrnereese/[email protected] |
17 | | - continue-on-error: true |
18 | | - with: |
19 | | - recurse: 'yes' |
20 | | - verbose-mode: 'yes' |
21 | | - |
22 | | - docs: |
23 | | - name: "Deploy docs" |
24 | | - runs-on: ubuntu-22.04 |
25 | | - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 18 | + build-and-deploy: |
| 19 | + |
| 20 | + runs-on: ubuntu-24.04 |
26 | 21 |
|
27 | 22 | steps: |
| 23 | + |
28 | 24 | - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + path: MAIN |
29 | 27 |
|
| 28 | + - name: Set fractal-web reference |
| 29 | + run: | |
| 30 | + FRACTAL_WEB_REFERENCE=$(cat MAIN/fractal-web-reference.txt) |
| 31 | + echo "FRACTAL_WEB_REFERENCE=$FRACTAL_WEB_REFERENCE" >> $GITHUB_ENV |
| 32 | +
|
| 33 | + - run: echo ${{ env.FRACTAL_WEB_REFERENCE }} |
| 34 | + |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + repository: fractal-analytics-platform/fractal-web |
| 38 | + ref: ${{ env.FRACTAL_WEB_REFERENCE }} |
| 39 | + path: WEB |
| 40 | + sparse-checkout: | |
| 41 | + components |
| 42 | + tasks-list |
| 43 | + |
30 | 44 | - uses: actions/setup-python@v5 |
31 | 45 | with: |
32 | | - python-version: '3.10' |
| 46 | + python-version: '3.11' |
33 | 47 | cache: pip |
34 | 48 |
|
35 | | - - name: Install requirements |
36 | | - run: python -m pip install -r requirements.txt |
| 49 | + # MKDocs build |
37 | 50 |
|
38 | | - - name: Deploy docs |
39 | | - uses: mhausenblas/mkdocs-deploy-gh-pages@master |
40 | | - env: |
41 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
42 | | - REQUIREMENTS: docs/doc-requirements.txt |
| 51 | + - name: Install dependencies |
| 52 | + run: python -m pip install -r MAIN/requirements.txt |
43 | 53 |
|
| 54 | + - name: MKDocs build |
| 55 | + run: mkdocs build --config-file MAIN/mkdocs.yml --strict --site-dir ./site |
44 | 56 |
|
45 | | - docs-build: |
46 | | - name: "Test docs build" |
47 | | - runs-on: ubuntu-22.04 |
48 | | - if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} |
| 57 | + - run: mv MAIN/site ./site |
49 | 58 |
|
50 | | - steps: |
51 | | - - uses: actions/checkout@v4 |
| 59 | + # Retrieve remote task-list data |
52 | 60 |
|
53 | | - - uses: actions/setup-python@v5 |
| 61 | + - name: Install requirements |
| 62 | + run: python3 -m pip install -r MAIN/tasks_data_retrieval/requirements.txt |
| 63 | + |
| 64 | + - name: Fetch tasks data |
| 65 | + run: python3 -u MAIN/tasks_data_retrieval/create_tasks_data.py |
| 66 | + |
| 67 | + - run: cat MAIN/tasks_data_retrieval/tasks.json |
| 68 | + |
| 69 | + - uses: actions/setup-node@v4 |
54 | 70 | with: |
55 | | - python-version: '3.10' |
56 | | - cache: pip |
| 71 | + node-version: 20 |
| 72 | + cache: npm |
| 73 | + cache-dependency-path: WEB/package-lock.json |
57 | 74 |
|
58 | | - - name: Install requirements |
59 | | - run: python -m pip install -r requirements.txt |
| 75 | + - name: Install main fractal-web dependencies |
| 76 | + run: | |
| 77 | + cd WEB |
| 78 | + npm install |
60 | 79 |
|
61 | | - - name: MKDocs build |
62 | | - run: mkdocs build --config-file mkdocs.yml |
| 80 | + - name: Install components dependencies |
| 81 | + run: | |
| 82 | + cd WEB/components |
| 83 | + npm install |
| 84 | +
|
| 85 | + - name: Install tasks-list dependencies |
| 86 | + run: | |
| 87 | + cd WEB/tasks-list |
| 88 | + npm install |
| 89 | +
|
| 90 | + - name: Move tasks.json file to tasks-list/src |
| 91 | + run: mv MAIN/tasks_data_retrieval/tasks.json WEB/tasks-list/src/ |
| 92 | + |
| 93 | + - name: Build tasks-list page |
| 94 | + run: | |
| 95 | + cd WEB/tasks-list |
| 96 | + npm run build |
| 97 | +
|
| 98 | + - name: Move tasks-list built files in docs site |
| 99 | + run: mv WEB/tasks-list/build/ site/task-table |
| 100 | + |
| 101 | + - name: Set last-updated timestamp |
| 102 | + run: | |
| 103 | + CURRENT_DATE=$(date +"%Y-%m-%d %H:%M %Z") |
| 104 | + echo "$CURRENT_DATE" |
| 105 | + sed -i'.bak1' "s/LASTUPDATEDPLACEHOLDER/$CURRENT_DATE/" site/available_tasks/index.html |
| 106 | + sed -i'.bak2' "s/FRACTALWEBREFERENCEPLACEHOLDER/${{ env.FRACTAL_WEB_REFERENCE }}/" site/available_tasks/index.html |
| 107 | + rm site/available_tasks/index.html.bak1 site/available_tasks/index.html.bak2 |
| 108 | +
|
| 109 | + - run: ls -lh site/* |
| 110 | + |
| 111 | + - name: Deploy docs |
| 112 | + if: ${{ ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.event.ref == 'refs/heads/main' }} |
| 113 | + uses: peaceiris/actions-gh-pages@v4 |
| 114 | + with: |
| 115 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 116 | + publish_dir: ./site |
0 commit comments