Skip to content

Github Action for emscripten deployment #1

Github Action for emscripten deployment

Github Action for emscripten deployment #1

name: Build and Deploy
on:
push:
branches: [ "trunk" ]
# pull_request:
# branches: [ "trunk" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build emscripten using docker image
run: |
# Generate build system
docker run -it --rm -v "$(pwd):/src" emscripten/emsdk emcmake cmake -S . -Bbuild-web -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-sUSE_GLFW=3 -sUSE_WEBGL2=1 -sFULL_ES3=1 -fexceptions --preload-file ./res/fonts/Cozette --preload-file ./shaders"
# Copy assets
mkdir -p build-web/res/fonts
mkdir -p build-web/shaders
cp -r res/fonts/Cozette build-web/res/fonts
cp ./shaders/*.webgl.* build-web/shaders
cp index.html ./build-web
# build
docker run -it --rm -v "$(pwd):/src" emscripten/emsdk cmake --build build-web -j
# prepare for distribution
mkdir -p dist
# copy generated files to dist
cp build-web/index.html dist
cp build-web/hellotext.* dist
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: dist # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch