Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm publish #215

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
71 changes: 71 additions & 0 deletions .github/workflows/wasmPublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Simple workflow that builds wasm and publish to npm registry
name: Build and publish wasm

on:
workflow_dispatch:
inputs:
release_version:
description: 'NPM Release Version'
required: true
type: string
default: 1.0.0
NPM_tag:
description: 'NPM Tag'
required: true
type: string
default: preview
NPM_publish_arg:
description: 'NPM Publish arg'
required: false
type: string
default: --dry-run

jobs:
tinyusdz-wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Emscripten SDK
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
# from https://github.com/Twinklebear/webgpu-cpp-usdz/blob/main/.github/workflows/deploy-page.yml
# TODO: 3.1.52 has a change to WebGPU API that is incompatible
# with the C++ bindings I have in the repo?
./emsdk install 3.1.51
./emsdk activate 3.1.51
- name: Configure
run: |
source ./emsdk/emsdk_env.sh
cd web
mkdir cmake-build
cd cmake-build
emcmake cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build WASM
working-directory: ${{ github.workspace }}/web/cmake-build
run: |
source ../../emsdk/emsdk_env.sh
make

- name: Prepare npm
working-directory: ${{ github.workspace }}/web/npm
run: |
cp ../dist/* .

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: 'tinyusdz'
path: ${{ github.workspace }}/web/npm

- name: Version & Publish Package
run: |
npm version --no-git-tag-version ${{ github.event.inputs.release_version }}
npm publish --access public --tag ${{ github.event.inputs.NPM_tag }} ${{ github.event.inputs.NPM_publish_arg }}
working-directory: ${{ github.workspace }}/web/npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 14 additions & 0 deletions web/npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "tinyusdz",
"version": "0.0.1",
"description": "Tinyusdz wasm",
"main": "tinyusdz.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"usdz"
],
"author": "",
"license": "ISC"
}
1 change: 1 addition & 0 deletions web/npm/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Tinyusdz
Loading