forked from MicroPythonOS/MicroPythonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.71 KB
/
Copy pathweb-pages.yml
File metadata and controls
84 lines (72 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build web target and deploy to GitHub Pages
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # allow manual workflow starts
# Allow the GITHUB_TOKEN to force-push the built site to the gh-pages branch.
permissions:
contents: write
# Only one concurrent deployment; don't cancel an in-progress run so a
# half-published site is never left behind.
concurrency:
group: gh-pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libffi-dev \
pkg-config \
cmake \
ninja-build
- name: Set up Emscripten SDK
# Puts emcc/em++/emar on PATH so build_mpos.sh skips its in-tree
# emsdk lookup. Bump the version if the build needs a newer toolchain.
uses: mymindstorm/setup-emsdk@v14
with:
version: 6.0.0
- name: Extract OS version
id: version
run: |
OS_VERSION=$(grep "release = " internal_filesystem/lib/mpos/build_info.py | cut -d "=" -f 2 | cut -d "#" -f 1 | tr -d " " | tr -d '"')
echo "OS_VERSION=$OS_VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $OS_VERSION"
- name: Build web (WebAssembly/Emscripten) target
run: ./scripts/build_mpos.sh web
- name: Smoke-test the _webterm stdio bridge on the built artifact
# Boots the built export headless, installs Module.__webterm.onOutput,
# sends the raw-REPL handshake and asserts the CRLF banner arrives.
# Catches a dead stdout mirror or wrong line endings before deploy.
run: |
npm install --no-save puppeteer
node tests/web_bridge_smoke.mjs web
- name: Upload built web export as a regular artifact
uses: actions/upload-artifact@v4
with:
name: MicroPythonOS_web_${{ steps.version.outputs.OS_VERSION }}.zip
path: web/
retention-days: 7
- name: Deploy to gh-pages branch
# Publish only on push to main; PRs just build for validation.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./web
publish_branch: gh-pages
# Export contains files/dirs starting with "_" (preloaded fs).
enable_jekyll: false
force_orphan: true # single squashed commit, no history