Fix WASM build scripts

This commit is contained in:
Wilson Lin 2022-06-22 00:56:29 +10:00
parent b6a39ac978
commit 86e7ca8af1
2 changed files with 11 additions and 2 deletions

View File

@ -47,4 +47,13 @@ jobs:
- name: Upload to B2
run: |
./b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
./b2 sync --compareVersions size --delete wasm/pkg/ b2://${{ secrets.CICD_CLI_B2_BUCKET_NAME }}/minify-html/deno/${{ steps.version.outputs.VERSION }}/
for f in wasm/pkg/*; do;
if [[ "$f" == *.js ]]; then
content_type='application/json'
elif [[ "$f" == *.wasm ]]; then
content_type='application/wasm'
else
content_type='application/octet-stream'
fi
./b2 upload-file --contentType "$content_type" ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} "$f" "minify-html/deno/${{ steps.version.outputs.VERSION }}/$(basename "$f")"
done

View File

@ -12,7 +12,7 @@ pushd pkg
# `bundler` is for WASM/npm, `web` is for Deno.
if [[ "$target" = "bundler" ]]; then
# Use -i.tmp to support macOS and Linux.
sed -i.tmp -E 's%"name": "index"%"name": "@minify-html/'$pkg_suffix'"%' package.json
sed -i.tmp -E 's%"name": "index"%"name": "@minify-html/wasm"%' package.json
rm package.json.tmp .gitignore
elif [[ "$target" = "web" ]]; then
rm package.json .gitignore