Skip to content

Commit

Permalink
Update build and release to include wasm on release
Browse files Browse the repository at this point in the history
  • Loading branch information
bbckr committed Sep 16, 2024
1 parent 4254bf0 commit df5c487
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ jobs:
cache-dependency-path: |
packages/node-hcl/go.sum
- run: yarn install
- run: yarn run lerna run build:go --stream
- run: yarn tsc
- run: yarn backstage-cli repo build
- run: yarn run lerna run build:go --stream
env:
WASM_OUTPUT_DIR: dist/wasm
- run: yarn multi-semantic-release --ignore-private-packages --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ jobs:
cache-dependency-path: |
packages/node-hcl/go.sum
- run: yarn install
- run: yarn run lerna run build:go --stream
- run: yarn tsc
- run: yarn backstage-cli repo build
- run: yarn run lerna run build:go --stream
env:
WASM_OUTPUT_DIR: dist/wasm
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 1 addition & 5 deletions packages/node-hcl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"test:go": "scripts/go-test.sh",
"test": "backstage-cli package test",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"lint": "backstage-cli package lint",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
"tsc:full": "tsc --skipLibCheck false --incremental false"
},
"devDependencies": {
"@types/fs-extra": "11.0.4",
Expand Down
8 changes: 8 additions & 0 deletions packages/node-hcl/scripts/get-wasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
#
# Copyright SeatGeek
# Licensed under the terms of the Apache-2.0 license. See LICENSE file in project root for terms.
#
wasm_dir=${WASM_OUTPUT_DIR:-"src/wasm"}
echo "Copying wasm_exec.js from GOROOT"
cp -rf "$(go env GOROOT)/misc/wasm/wasm_exec.js" $wasm_dir
9 changes: 3 additions & 6 deletions packages/node-hcl/scripts/go-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
# Copyright SeatGeek
# Licensed under the terms of the Apache-2.0 license. See LICENSE file in project root for terms.
#
wasm_dir="src/wasm"
echo "Copying wasm_exec.js from GOROOT"
cp -rf "$(go env GOROOT)/misc/wasm/wasm_exec.js" $wasm_dir

echo "Building WASM"

wasm_dir=${WASM_OUTPUT_DIR:-"src/wasm"}
echo "Packaging WASM"
wasm_path="$wasm_dir/main.wasm"
GOOS=js GOARCH=wasm go get .
GOOS=js GOARCH=wasm go build -o $wasm_path
gzip -9 -v -c $wasm_path > $wasm_path.gz
rm $wasm_path

echo "WASM exported to $wasm_path.gz"

0 comments on commit df5c487

Please sign in to comment.