Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
on:
push:
branches: [main, dev]
pull_request:
branches: [dev]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -161,35 +163,52 @@

- uses: mymindstorm/setup-emsdk@1f4f5866c1f8745a10fcb64c4d7a0eb7a8daed9d

- uses: pnpm/action-setup@v4
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
with:
version: 10

- uses: actions/setup-node@670825a89dc0abd596e7a3abd0f5e3f6e5faf37c
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Build WASM
run: |
emcmake cmake -B build-wasm -DCMAKE_BUILD_TYPE=Release .
emcmake cmake -B build-wasm \
-DCMAKE_BUILD_TYPE=Release \
-DIMG2NUM_BUILD_C=ON \
-DIMG2NUM_BUILD_PYTHON=OFF \
-DIMG2NUM_BUILD_EXAMPLES=OFF \
-DIMG2NUM_DEBUG_CACHE_VARIABLES_DUMP=ON \
.
cmake --build build-wasm

- name: Build JS
run: pnpm build
working-directory: packages/js

- name: Package
run: |
release_version=${{ needs.release-please.outputs.js_version }}
tar -czf img2num-v${release_version}.tar.gz \
build-wasm \
packages/js/index.js \
packages/js/safeWasmWrappers.js \
packages/js/wasmClient.js \
packages/js/wasmWorker.js \
packages/js/imageToUint8ClampedArray.js
tar -czf img2num-js-v${release_version}.tar.gz packages/js/dist
tar -czf img2num-js-wasm-only-v${release_version}.tar.gz packages/js/build-wasm

# Draft release when not main — same as C/C++ above
- uses: softprops/action-gh-release@403a5240f3837fa857f642062e05aad6bb3391ca
with:
tag_name: ${{ needs.release-please.outputs.js_tag }}
files: img2num-v${{ needs.release-please.outputs.js_version }}.tar.gz
files: |
img2num-js-v${{ needs.release-please.outputs.js_version }}.tar.gz
img2num-js-wasm-only-v${{ needs.release-please.outputs.js_version }}.tar.gz
draft: ${{ needs.release-please.outputs.is_dry_run == 'true' }}

- uses: actions/setup-node@670825a89dc0abd596e7a3abd0f5e3f6e5faf37c
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

# --dry-run exercises the full publish pipeline (auth, package validation,
# tarball construction) without actually pushing to the registry.
- name: Publish to npm
run: npm publish --access public --provenance ${{ needs.release-please.outputs.is_dry_run == 'true' && '--dry-run' || '' }}
run: pnpm publish --access public --provenance ${{ needs.release-please.outputs.is_dry_run == 'true' && '--dry-run' || '' }}
working-directory: packages/js
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(IMG2NUM_STRICT_CXX_FLAGS
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/permissive->
)

option(IMG2NUM_BUILD_C "Build C bindings" ON)
option(IMG2NUM_BUILD_C "Build C bindings (required for WASM builds)" ON)
option(IMG2NUM_BUILD_PYTHON "Build Python bindings" OFF)
option(IMG2NUM_BUILD_EXAMPLES "Build example applications" ON)
option(IMG2NUM_DEBUG_CACHE_VARIABLES_DUMP "Dump CMake environment variables in Debug mode" ON)
Expand Down
Loading