Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,38 @@ for p in "${platforms[@]}"; do

done

# Build WebAssembly binary
echo ""
echo "Building gh-aw WebAssembly binary..."
GOOS=js GOARCH=wasm go build \
-trimpath \
-ldflags="-s -w" \
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The released Wasm binary is built without any version/release metadata. In the current codebase the compiler defaults to defaultVersion="dev" and DetectActionMode() will therefore choose dev mode (local action refs like ./actions/setup), which will produce compiled workflows that won’t run in consumer repos. Consider embedding release/version info into the Wasm build (e.g., add version/isRelease vars to cmd/gh-aw-wasm similar to cmd/gh-aw, set workflow.SetDefaultVersion/SetVersion/SetIsRelease in its main(), and pass -X ... via this build step) or otherwise default the Wasm compiler to a consumer-safe action mode.

Suggested change
-ldflags="-s -w" \
-ldflags="-s -w -X main.version=${VERSION} -X main.isRelease=true" \

Copilot uses AI. Check for mistakes.
-o "dist/gh-aw.wasm" \
./cmd/gh-aw-wasm

# Run wasm-opt if available
if command -v wasm-opt &> /dev/null; then
echo "Running wasm-opt -Oz (size optimization)..."
BEFORE=$(wc -c < dist/gh-aw.wasm)
wasm-opt -Oz --enable-bulk-memory dist/gh-aw.wasm -o dist/gh-aw.opt.wasm && \
mv dist/gh-aw.opt.wasm dist/gh-aw.wasm
AFTER=$(wc -c < dist/gh-aw.wasm)
echo "wasm-opt: $BEFORE -> $AFTER bytes"
fi

# Bundle wasm_exec.js (required Go runtime for loading the wasm binary)
WASM_EXEC_SRC="$(go env GOROOT)/lib/wasm/wasm_exec.js"
if [ ! -f "$WASM_EXEC_SRC" ]; then
WASM_EXEC_SRC="$(go env GOROOT)/misc/wasm/wasm_exec.js"
fi
if [ ! -f "$WASM_EXEC_SRC" ]; then
echo "error: wasm_exec.js not found in Go installation" >&2
exit 1
fi
cp "$WASM_EXEC_SRC" dist/wasm_exec.js
echo "Bundled wasm_exec.js from $WASM_EXEC_SRC"

echo ""
echo "Build complete. Binaries:"
ls -lh dist/

Expand Down