Skip to content

Merge pull request #2688 from GaijinEntertainment/bbatkin/live-api-dr… #129

Merge pull request #2688 from GaijinEntertainment/bbatkin/live-api-dr…

Merge pull request #2688 from GaijinEntertainment/bbatkin/live-api-dr… #129

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [master]
workflow_dispatch:
# Only one Pages deployment at a time
concurrency:
group: pages-deploy
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest-fat
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: "SCM Checkout"
uses: actions/checkout@v4
- name: "Install Python dependencies"
run: |
pip install -r doc/requirements.txt
pip install markdown
- name: "Install CMake and Ninja"
uses: lukka/get-cmake@latest
- name: "Build: Daslang (for das2rst)"
run: |
set -eux
mkdir build
cmake --no-warn-unused-cli -B./build \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DDAS_HV_DISABLED=OFF \
-DDAS_PUGIXML_DISABLED=OFF \
-DDAS_LLVM_DISABLED=ON \
-DDAS_GLFW_DISABLED=ON \
-G Ninja
cmake --build ./build --target daslang
- name: "Run das2rst"
run: |
set -eux
./bin/daslang doc/reflections/das2rst.das
- name: "Build Sphinx HTML"
run: |
sphinx-build -W --keep-going -b html -d doc/sphinx-build doc/source build/site
- name: "Build Sphinx LaTeX"
run: |
sphinx-build -W --keep-going -b latex -d doc/sphinx-build doc/source build/latex
- name: "Compile PDF: daslangstdlib.tex"
uses: xu-cheng/latex-action@v4
with:
root_file: daslangstdlib.tex
working_directory: build/latex
continue_on_error: true
- name: "Compile PDF: daslang.tex"
uses: xu-cheng/latex-action@v4
with:
root_file: daslang.tex
working_directory: build/latex
continue_on_error: true
- name: "Build WASM (Emscripten) for /playground/ + /files/wasm/"
run: |
set -eux
cd web
# step0 only clones the emsdk wrapper — the toolchain itself
# (emsdk/upstream/emscripten/) lands via the install+activate pair
# that web/step1_emsdk_activate_linux.sh does locally. Without these,
# cmake's -DCMAKE_TOOLCHAIN_FILE points at a path that doesn't
# exist yet and the WASM build silently fails under continue-on-error.
bash step0_emsdk_install.sh
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
bash -c "source emsdk/emsdk_env.sh && \
mkdir -p build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake ../ && \
ninja"
continue-on-error: true
- name: "Fetch dasProfile benchmark JSON"
run: |
set -eux
curl -sSL -o site/files/profile_results.json \
https://raw.githubusercontent.com/borisbat/dasProfile/main/profile_results.json
continue-on-error: true
- name: "Stage site for deployment"
run: |
set -eux
mkdir -p _site
# Static landing page and assets
cp site/index.html _site/
cp site/downloads.html _site/
cp site/robots.txt _site/
cp -r site/files _site/files
# Freshly-built Sphinx HTML docs
cp -r build/site _site/doc
# PDFs (referenced by index.html)
cp build/latex/daslang.pdf _site/doc/daslang.pdf || echo "WARNING: daslang.pdf not found"
cp build/latex/daslangstdlib.pdf _site/doc/daslangstdlib.pdf || echo "WARNING: daslangstdlib.pdf not found"
# Blog + news + changelist (regenerated each publish). Pin --site-url
# explicitly so feed.xml entries point at the production domain even
# if the default in build_blog.py drifts.
python3 site/blog/build_blog.py \
--posts site/blog/_posts \
--news site/_news \
--template site/blog/template.html \
--site-url https://daslang.io \
--out _site/
# Playground: vendor web/ui IDE + WASM artifacts.
# The WASM build step has continue-on-error so docs/blog still publish
# when emsdk hiccups. The cost of that resilience is partial state:
# web/output may exist without the daslang_static.{js,wasm} artifacts.
# Refuse to stage a half-built playground in that case — Pages preserves
# the previously-deployed /playground/, so the visible Run button keeps
# working instead of 404'ing its runtime.
if [ -f web/output/daslang_static.js ] && [ -f web/output/daslang_static.wasm ]; then
mkdir -p _site/playground _site/files/wasm
# Copy IDE source files (CodeMirror, jQuery, main.js/css, etc.)
cp -r web/ui/src/* _site/playground/
# Copy WASM artifacts — known-present after the guard above.
cp web/output/daslang_static.js _site/playground/
cp web/output/daslang_static.wasm _site/playground/
cp web/output/daslang_static.js _site/files/wasm/
cp web/output/daslang_static.wasm _site/files/wasm/
# Copy sample data if present
cp -r web/ui/samples _site/playground/samples 2>/dev/null || true
# Our Forge-skinned playground/index.html + skin CSS + init shim take precedence.
# CodeMirror bundle (codemirror.min.js/css, simple-mode.js, daslang-*.js,
# cm-forge.css) is served from /files/cm/ — copied via `cp -r site/files`
# earlier, so nothing extra to copy here.
cp site/playground/index.html _site/playground/index.html
cp site/playground/forge-skin.css _site/playground/
# Forge playground scripts (init shim + tabs + share + splitter).
# Glob so future playground-*.js additions land automatically.
cp site/playground/playground-*.js _site/playground/
else
# WASM artifacts missing. actions/deploy-pages publishes _site as
# a complete snapshot (no layering over the prior deploy), so an
# absent _site/playground/ would 404 the route. Stage a
# placeholder instead — the URL keeps resolving to something
# useful while we re-roll the runtime.
echo "WARNING: daslang_static.{js,wasm} missing under web/output — staging placeholder /playground/."
mkdir -p _site/playground
cp site/playground/placeholder.html _site/playground/index.html
fi
# GitHub Pages control files
touch _site/.nojekyll
- name: "Upload Pages artifact"
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: "Deploy to GitHub Pages"
id: deployment
uses: actions/deploy-pages@v4