build #6
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 | |
permissions: | |
contents: write | |
repository-projects: write | |
on: | |
workflow_dispatch: | |
branches: [dev] | |
jobs: | |
build: | |
name: build-wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
git pull | |
cur=$(git rev-parse --abbrev-ref HEAD) | |
echo "current branch is $cur." | |
if [ "$cur" != "dev" ]; then | |
echo "err : not dev branch" | |
exit 1 | |
fi | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git clone https://github.com/emscripten-core/emsdk.git | |
cd emsdk/ | |
./emsdk install latest | |
./emsdk activate latest | |
source ./emsdk_env.sh | |
emcc -v | |
cd .. | |
git submodule update --init --recursive | |
make clean | |
npm install -D @types/node | |
npm run build:mcl_c.js | |
npm run build:browser | |
npm test | |
sha256sum src/mcl_c.js browser/mcl.js | |
git add -f src/mcl_c.js browser/mcl.js | |
changes=$(git diff --staged --numstat | wc -l) | |
if [[ $changes -gt 0 ]] | |
then | |
git commit -m "build: mcl_c.js is generated by GitHub Action" | |
git push origin dev | |
fi |