forked from solvespace/solvespace
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (69 loc) · 2.11 KB
/
wasmlib.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: WASM Library
on:
push:
branches: [ master, python, experiments, stateful-c-lib ]
tags: [ v* ]
jobs:
build-wasmlib:
name: WASM library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init extlib/mimalloc extlib/eigen
- name: Pack
shell: bash
run: |
.github/scripts/build-wasmlib.sh
cd build-wasmlib/bin
rm libmimalloc.a || true
zip -r slvs-wasmlib.zip .
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: slvs-wasmlib
path: build-wasmlib/bin/slvs-wasmlib.zip
publish-wasmlib:
name: publish WASM library
needs: [
build-wasmlib,
]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14.x'
registry-url: https://registry.npmjs.org/
- name: prepare
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
git fetch --unshallow --tags
ls artifacts
unzip artifacts/slvs-wasmlib/slvs-wasmlib.zip -d js
ls js
# bump version
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-dev.${GITHUB_RUN_NUMBER}"
is_dev="1"
fi
jq --arg version "${version}" '.version = $version' package.json > package.json.tmp
mv package.json.tmp js/package.json
cd js
if [ "${is_dev}" == "1" ]; then
npm publish --access public --tag dev
else
npm publish --access public
fi