Skip to content

Commit 8bb0988

Browse files
committed
update release action and bundle
1 parent fc025ff commit 8bb0988

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ jobs:
3232
run: |
3333
deno task release
3434
35-
- name: Generate datex.js bundle
35+
- name: Generate datex.js bundle for pages (without inline WASM)
3636
run: |
37-
deno task build-bundle
37+
deno task build-bundle
38+
39+
- name: Set up GitHub Pages directory with datex.js and WASM
40+
run: |
41+
mkdir -p ./pages
42+
cp ./datex.js ./pages/datex.js
43+
cp ./src/datex-core/datex_core_js.wasm ./pages/datex_core_js.wasm
44+
45+
- name: Generate datex.js bundle for release artifact (with inline WASM)
46+
run: |
47+
deno task build-bundle --inline-wasm
3848
3949
- name: Create Tag
4050
id: create_tag
@@ -54,11 +64,6 @@ jobs:
5464
env:
5565
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5666

57-
- name: Set up GitHub Pages directory
58-
run: |
59-
mkdir -p ./pages
60-
cp ./datex.js ./pages/datex.js
61-
6267
- name: Upload build artifacts
6368
uses: actions/upload-pages-artifact@v3
6469
with:

scripts/build-bundle.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { encodeBase64 } from "jsr:@std/encoding/base64";
22

3+
// check if --inline-wasm argument is passed
4+
// if --inline-wasm is passed, the wasm file will be embedded into the bundle
5+
const inlineWASM = Deno.args.includes("--inline-wasm");
6+
37
const command = new Deno.Command(Deno.execPath(), {
48
args: [
59
"bundle",
@@ -22,6 +26,12 @@ if (code !== 0) {
2226
Deno.exit(code);
2327
} else {
2428
console.log("Script bundled successfully to datex.js");
29+
30+
if (!inlineWASM) {
31+
console.log("Skipping WASM embedding, inline flag not set.");
32+
Deno.exit(0);
33+
}
34+
2535
// replace await WebAssembly.instantiateStreaming(fetch(new URL("datex_core_js.wasm",import.meta.url)) with
2636
// WebAssembly.instantiate inline
2737
const wasmFile = new URL(

0 commit comments

Comments
 (0)