BLUELOVETH 2 年之前
父节点
当前提交
3699f39043
共有 2 个文件被更改,包括 42 次插入0 次删除
  1. 35 0
      .github/website.yml
  2. 7 0
      build_web.sh

+ 35 - 0
.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 }}

+ 7 - 0
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