Update fractal-web version #125
Workflow file for this run
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
name: Build and deploy | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
# Re-run every Tuesday at 6AM | |
# schedule: | |
# - cron: "0 6 * * 2" | |
# Re-run on demand: | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: MAIN | |
- name: Set fractal-web reference | |
run: | | |
FRACTAL_WEB_REFERENCE=$(cat MAIN/fractal-web-reference.txt) | |
echo "FRACTAL_WEB_REFERENCE=$FRACTAL_WEB_REFERENCE" >> $GITHUB_ENV | |
- run: echo ${{ env.FRACTAL_WEB_REFERENCE }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: fractal-analytics-platform/fractal-web | |
ref: ${{ env.FRACTAL_WEB_REFERENCE }} | |
path: WEB | |
sparse-checkout: | | |
components | |
tasks-list | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
# MKDocs build | |
- name: Install dependencies | |
run: python -m pip install -r MAIN/requirements.txt | |
- name: MKDocs build | |
run: mkdocs build --config-file MAIN/mkdocs.yml --strict --site-dir ./site | |
- run: mv MAIN/site ./site | |
# Retrieve remote task-list data | |
- name: Install requirements | |
run: python3 -m pip install -r MAIN/tasks_data_retrieval/requirements.txt | |
- name: Fetch tasks data | |
run: python3 -u MAIN/tasks_data_retrieval/create_tasks_data.py | |
- run: cat MAIN/tasks_data_retrieval/tasks.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: WEB/package-lock.json | |
- name: Install main fractal-web dependencies | |
run: | | |
cd WEB | |
npm install | |
- name: Install components dependencies | |
run: | | |
cd WEB/components | |
npm install | |
- name: Install tasks-list dependencies | |
run: | | |
cd WEB/tasks-list | |
npm install | |
- name: Move tasks.json file to tasks-list/src | |
run: mv MAIN/tasks_data_retrieval/tasks.json WEB/tasks-list/src/ | |
- name: Build tasks-list page | |
run: | | |
cd WEB/tasks-list | |
npm run build | |
- name: Move tasks-list built files in docs site | |
run: mv WEB/tasks-list/build/ site/task-table | |
- name: Set last-updated timestamp | |
run: | | |
CURRENT_DATE=$(date +"%Y-%m-%d %H:%M %Z") | |
echo "$CURRENT_DATE" | |
sed -i'.bak1' "s/LASTUPDATEDPLACEHOLDER/$CURRENT_DATE/" site/fractal_tasks/index.html | |
sed -i'.bak2' "s/FRACTALWEBREFERENCEPLACEHOLDER/${{ env.FRACTAL_WEB_REFERENCE }}/" site/fractal_tasks/index.html | |
rm site/fractal_tasks/index.html.bak1 site/fractal_tasks/index.html.bak2 | |
- run: ls -lh site/* | |
- name: Deploy docs | |
if: ${{ ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.event.ref == 'refs/heads/main' }} | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site |