mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-16 08:44:03 +02:00
Integrate webapp (simulator) into docs workflow
- Merge deploy-webapp.yml into docs.yml workflow - Build simulator and place at /simulator/ subdirectory - Update docs links to use relative paths to simulator - Remove separate deploy-webapp.yml to avoid conflicts The combined workflow now: 1. Builds docs with zensical 2. Builds webapp with shinylive 3. Copies webapp to site/simulator/ 4. Deploys everything to GitHub Pages Simulator will be at adaptive-lighting.nijho.lt/simulator/
This commit is contained in:
parent
801905f8b9
commit
c439c5315b
5 changed files with 27 additions and 69 deletions
63
.github/workflows/deploy-webapp.yml
vendored
63
.github/workflows/deploy-webapp.yml
vendored
|
|
@ -1,63 +0,0 @@
|
|||
# Simple workflow for deploying WebAssembly app to GitHub Pages
|
||||
name: Deploy WebAssembly app to Pages
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Single deploy job since we're just deploying
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set Up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: 3.14.2
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
pip install -r webapp/requirements.txt
|
||||
pip install shinylive
|
||||
|
||||
- name: Build the WebAssembly app
|
||||
run: |
|
||||
set -ex
|
||||
cp custom_components/adaptive_lighting/color_and_brightness.py webapp/color_and_brightness.py
|
||||
sed -i 's/homeassistant.util.color/homeassistant_util_color/g' "webapp/color_and_brightness.py"
|
||||
shinylive export webapp site
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
# Upload the 'site' directory, where your app has been built
|
||||
path: "site"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
25
.github/workflows/docs.yml
vendored
25
.github/workflows/docs.yml
vendored
|
|
@ -10,12 +10,15 @@ on:
|
|||
- 'custom_components/adaptive_lighting/_docs_helpers.py'
|
||||
- 'custom_components/adaptive_lighting/docs_gen.py'
|
||||
- 'custom_components/adaptive_lighting/const.py'
|
||||
- 'custom_components/adaptive_lighting/color_and_brightness.py'
|
||||
- 'webapp/**'
|
||||
- '.github/workflows/docs.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'README.md'
|
||||
- 'zensical.toml'
|
||||
- 'webapp/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
|
@ -42,18 +45,22 @@ jobs:
|
|||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v4
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install documentation dependencies
|
||||
run: |
|
||||
uv pip install --system zensical markdown-code-runner
|
||||
uv pip install --system pandas voluptuous homeassistant
|
||||
|
||||
- name: Install webapp dependencies
|
||||
run: |
|
||||
uv pip install --system -r webapp/requirements.txt
|
||||
uv pip install --system shinylive
|
||||
|
||||
- name: Set up PYTHONPATH
|
||||
run: |
|
||||
echo "PYTHONPATH=$GITHUB_WORKSPACE/custom_components:$GITHUB_WORKSPACE" >> $GITHUB_ENV
|
||||
|
||||
- name: Run markdown-code-runner on docs
|
||||
run: |
|
||||
# Process all markdown files with CODE blocks
|
||||
for f in docs/*.md docs/**/*.md; do
|
||||
if [ -f "$f" ]; then
|
||||
echo "Processing $f..."
|
||||
|
|
@ -64,6 +71,20 @@ jobs:
|
|||
- name: Build documentation
|
||||
run: zensical build
|
||||
|
||||
- name: Build webapp (simulator)
|
||||
run: |
|
||||
set -ex
|
||||
cp custom_components/adaptive_lighting/color_and_brightness.py webapp/color_and_brightness.py
|
||||
sed -i 's/homeassistant.util.color/homeassistant_util_color/g' "webapp/color_and_brightness.py"
|
||||
shinylive export webapp webapp-site
|
||||
|
||||
- name: Integrate webapp into docs
|
||||
run: |
|
||||
# Copy webapp into docs site at /simulator/
|
||||
mkdir -p site/simulator
|
||||
cp -r webapp-site/* site/simulator/
|
||||
echo "Webapp integrated at site/simulator/"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ These graphs were generated using the values calculated by the Adaptive Lighting
|
|||
The best way to understand brightness modes is to experiment with the interactive simulator:
|
||||
|
||||
<div style="text-align: center; margin: 2rem 0;">
|
||||
<a href="https://basnijholt.github.io/adaptive-lighting" class="simulator-link">
|
||||
<a href="../simulator/" class="simulator-link">
|
||||
🌞 Try the Simulator 🌛
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ hide:
|
|||
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=basnijholt&repository=adaptive-lighting&category=integration" class="md-button md-button--primary">
|
||||
Install via HACS
|
||||
</a>
|
||||
<a href="https://basnijholt.github.io/adaptive-lighting" class="md-button">
|
||||
<a href="simulator/" class="md-button">
|
||||
Try the Simulator
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -82,7 +82,7 @@ Adaptive Lighting provides four switches for each configuration (using "living_r
|
|||
Visualize how Adaptive Lighting will work with your settings using the interactive simulator:
|
||||
|
||||
<div style="text-align: center; margin: 2rem 0;">
|
||||
<a href="https://basnijholt.github.io/adaptive-lighting" class="simulator-link">
|
||||
<a href="simulator/" class="simulator-link">
|
||||
🌞 Adaptive Lighting Simulator 🌛
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Resources, tutorials, and related projects for Adaptive Lighting.
|
|||
Visualize how different settings affect your lighting throughout the day:
|
||||
|
||||
<div style="text-align: center; margin: 2rem 0;">
|
||||
<a href="https://basnijholt.github.io/adaptive-lighting" class="simulator-link">
|
||||
<a href="../simulator/" class="simulator-link">
|
||||
🌞 Open the Simulator 🌛
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue