build_wasm #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "build_wasm" | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Install Wasm-pack | |
run: | | |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.15.x" | |
- name: Install rollup | |
run: | | |
npm install --global [email protected] | |
- name: Build | |
working-directory: aptos-wasm | |
run: | | |
echo "Directory structure before build:" | |
ls -R | |
for dir in ./*/; do | |
if [ -d "$dir" ]; then | |
echo "Building in directory: $dir" | |
(cd "$dir" && wasm-pack build --release --target web -d pkg) || { | |
echo "Build failed in directory: $dir" | |
exit 1 | |
} | |
else | |
echo "No subdirectories found in aptos-wasm" | |
fi | |
done | |
- name: Generate npm pkg | |
run: | | |
ls -R ./aptos-wasm | |
chmod +x ./gen-npm-pkg.sh | |
./gen-npm-pkg.sh | |
- name: Publish to npm | |
working-directory: aptos-wasm-bindings | |
run: | | |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_ACCESS_TOKEN }} | |
npm publish --access public |