diff --git a/.github/website.yml b/.github/website.yml new file mode 100644 index 00000000..b5f86506 --- /dev/null +++ b/.github/website.yml @@ -0,0 +1,35 @@ +name: website + +on: + push: + branches: [ main ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + ################################################### + - uses: actions/setup-node@v3.1.1 + - name: Retype build + run: | + cd docs + npm install retypeapp --global + retype build + ################################################### + - name: Setup emsdk + uses: mymindstorm/setup-emsdk@v12 + with: + version: 3.1.25 + actions-cache-folder: 'emsdk-cache' + - name: Compile + run: | + bash build_web.sh + mv web docs/.retype/static + ################################################### + - uses: crazy-max/ghaction-github-pages@v3 + with: + target_branch: gh-pages + build_dir: docs/.retype + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build_web.sh b/build_web.sh new file mode 100644 index 00000000..bfc5738a --- /dev/null +++ b/build_web.sh @@ -0,0 +1,7 @@ +python3 prebuild.py + +rm -rf web/lib +mkdir web/lib + +SRC=$(find src/ -name "*.cpp") +em++ $SRC -Iinclude/ -fno-rtti -fexceptions -O3 -sEXPORTED_FUNCTIONS=_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_vm -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js \ No newline at end of file