@@ -144,13 +144,64 @@ jobs:
144144 with :
145145 path : coverage
146146
147+ - name : wasm npm build
148+ if : matrix.name == 'wasm'
149+ run : |
150+ git clone https://github.com/sqlite/sqlite-wasm.git sqlite-wasm
151+ rm -rf sqlite-wasm/sqlite-wasm/*
152+ unzip dist/sqlite-wasm.zip -d sqlite-wasm/tmp
153+ mv sqlite-wasm/tmp/sqlite-wasm-*/jswasm sqlite-wasm/sqlite-wasm
154+ rm -rf sqlite-wasm/tmp sqlite-wasm/bin sqlite-wasm/demo sqlite-wasm/package-lock.json
155+
156+ PKG=sqlite-wasm/package.json
157+ TMP=sqlite-wasm/package.tmp.json
158+
159+ # Get versions from make commands
160+ SQLITE_VERSION=$(make sqlite_version)
161+ CLOUDSYNC_VERSION=$(make version)
162+
163+ DESC="SQLite Wasm compiled with the automatically initialized cloudsync extension. Conveniently packaged as an ES Module for effortless integration."
164+
165+ jq \
166+ --arg name "cloudsync/sqlite-wasm" \
167+ --arg version "${SQLITE_VERSION}+cloudsync-${CLOUDSYNC_VERSION}" \
168+ --arg desc "$DESC" \
169+ --argjson keywords '["offsync","cloudsync","sqliteai"]' \
170+ --arg repo_url "git+https://github.com/sqliteai/sqlite-sync.git" \
171+ --arg author "Gioele Cantoni ([email protected] )" \ 172+ --arg bugs_url "https://github.com/sqliteai/sqlite-sync/issues" \
173+ --arg homepage "https://github.com/sqliteai/sqlite-sync#readme" \
174+ '
175+ .name = $name
176+ | .version = $version
177+ | .description = $desc
178+ | .keywords += $keywords
179+ | del(.bin)
180+ | .scripts |= with_entries(select(
181+ .key != "build"
182+ and .key != "start"
183+ and .key != "start:node"
184+ and .key != "prepublishOnly"
185+ and .key != "deploy"
186+ ))
187+ | .repository.url = $repo_url
188+ | .author = $author
189+ | .bugs.url = $bugs_url
190+ | .homepage = $homepage
191+ | del(.devDependencies.decompress)
192+ | del(.devDependencies["http-server"])
193+ | del(.devDependencies.shx)
194+ ' "$PKG" > "$TMP" && mv "$TMP" "$PKG"
195+
196+ cd sqlite-wasm && npm i && npm run fix && npm run publint && npm run check-types && npm pack
197+
147198148199 if : always()
149200 with :
150201 name : cloudsync-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
151202 path : |
152203 dist/cloudsync.*
153- dist/ sqlite-wasm.zip
204+ sqlite-wasm/*.tgz
154205 if-no-files-found : error
155206
156207 release :
@@ -179,8 +230,7 @@ jobs:
179230 - name : release tag version from cloudsync.h
180231 id : tag
181232 run : |
182- FILE="src/cloudsync.h"
183- VERSION=$(grep -oP '#define CLOUDSYNC_VERSION\s+"\K[^"]+' "$FILE")
233+ VERSION=$(make version)
184234 if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
185235 LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
186236 if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
0 commit comments