Skip to content

Commit 52615cd

Browse files
Add build-docs workflow
1 parent 3ab9a52 commit 52615cd

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

.github/workflows/build-docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: build-docs
2+
on:
3+
release:
4+
types: [created]
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "**"
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Setup Pages
17+
uses: actions/configure-pages@v5
18+
- run: npm ci
19+
- name: Build docs
20+
run: npm run docs
21+
- name: Upload artifact
22+
uses: actions/upload-pages-artifact@v3
23+
with:
24+
path: ./docs/build
25+
26+
deploy:
27+
permissions:
28+
pages: write
29+
id-token: write
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
34+
needs: build
35+
steps:
36+
- name: Deploy to GitHub Pages
37+
id: deployment
38+
uses: actions/deploy-pages@v4

package-lock.json

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"vitest": "^2.0.0"
3939
},
4040
"dependencies": {
41+
"@microbit/microbit-fs": "^0.9.2",
4142
"@microbit/microbit-universal-hex": "^0.2.2",
4243
"@types/web-bluetooth": "^0.0.20",
4344
"crelt": "^1.0.6",

src/demo.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { MicrobitWebUSBConnection } from "../lib/usb";
2020
import { MicrobitRadioBridgeConnection } from "../lib/usb-radio-bridge";
2121
import "./demo.css";
2222
import { MagnetometerDataEvent } from "../lib/magnetometer";
23+
import { MicropythonFsHex } from "@microbit/microbit-fs";
24+
import { BoardId } from "../lib/board-id";
2325

2426
type ConnectionType = "usb" | "bluetooth" | "radio";
2527

@@ -209,9 +211,15 @@ const createFlashSection = (): Section => {
209211
const file = (e.currentTarget as HTMLInputElement).files?.item(0);
210212
if (file) {
211213
const text = await file.text();
214+
const boardId = BoardId.forVersion("V1").id;
215+
console.log(boardId);
216+
const micropythonFs = new MicropythonFsHex([
217+
{ hex: text, boardId },
218+
]);
212219
if (connection.flash) {
213220
console.time("flash");
214-
await connection.flash(createUniversalHexFlashDataSource(text), {
221+
const hex = micropythonFs.getIntelHex(boardId);
222+
await connection.flash(async () => hex, {
215223
partial: true,
216224
progress: (percentage: number | undefined) => {
217225
console.log(percentage);

0 commit comments

Comments
 (0)