Skip to content

Commit

Permalink
allow skipping Wasm build by SKIP_WASM_BUILD environment variable o…
Browse files Browse the repository at this point in the history
…n deploying playground
  • Loading branch information
rhysd committed Jun 11, 2024
1 parent 21e3529 commit bc937eb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ npm run serve
git push
```

Note: `SKIP_BUILD_WASM` environment variable can skip building `main.wasm` binary. Please set it when the Wasm binary
doesn't need to be updated. It is important to avoid bloating a repository size by including a big Wasm binary in a
commit.

```sh
SKIP_BUILD_WASM=true bash ./playground/deploy.bash
```

## Maintain auto-generated sources

Some files are generated by scripts in [`scripts/`](./scripts) directory. These files are kept up-to-date by CI workflows.
Expand Down
22 changes: 15 additions & 7 deletions playground/deploy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,26 @@ files=(
style.css
)

echo 'Copying built assets from ./playground to ./playground-dist'
if [[ "$SKIP_BUILD_WASM" != "" ]]; then
files=("${files[@]/main.wasm}")
fi

echo "Copying built assets from ./playground to ./playground-dist: " "${files[@]}"
for f in "${files[@]}"; do
cp -R "./playground/${f}" "./playground-dist/${f}"
done

echo 'Applying wasm-opt to ./playground-dist/main.wasm'
wasm-opt -O -o ./playground-dist/opt.wasm ./playground-dist/main.wasm --enable-bulk-memory
mv ./playground-dist/opt.wasm ./playground-dist/main.wasm
if [[ "$SKIP_BUILD_WASM" == "" ]]; then
echo 'Applying wasm-opt to ./playground-dist/main.wasm'
wasm-opt -O -o ./playground-dist/opt.wasm ./playground-dist/main.wasm --enable-bulk-memory
mv ./playground-dist/opt.wasm ./playground-dist/main.wasm
else
echo 'Skipped applying wasm-opt because SKIP_BUILD_WASM environment variable is set'
fi

echo 'Generating and copying manual'
make ./man/actionlint.1.html
cp ./man/actionlint.1.html ./playground-dist/usage.html
cp ./man/actionlint.1.html ./playground-dist/man.html

echo 'Switching to gh-pages branch'
git checkout gh-pages
Expand All @@ -59,8 +67,8 @@ for f in "${files[@]}"; do
done

echo 'Adding manual'
cp ./playground-dist/usage.html ./usage.html
git add ./usage.html
cp ./playground-dist/man.html ./man.html
git add ./man.html

echo 'Making commit for new deploy'
git commit -m "deploy from ${sha}"
Expand Down

0 comments on commit bc937eb

Please sign in to comment.