update python example #80
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 JavaScript SDK | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '**.md' | |
- 'python/**' | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Should packages be published to npm?' | |
required: true | |
default: false | |
type: boolean | |
jobs: | |
client-build: | |
name: Build SDK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
- name: Install wasm-pack | |
uses: jetli/wasm-pack-action@f98777369a49686b132a9e8f0fdd59837bf3c3fd | |
with: | |
version: v0.10.3 | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Run build | |
run: | | |
npm run build | |
- name: Run tests | |
run: | | |
npm test | |
- name: Run end-to-end tests | |
run: | | |
npm run e2e-tests | |
- name: Upload single-file bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdk-bundle | |
path: dist/blyss-bundle.min.js | |
- name: Upload complete bundle | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdk | |
path: dist/ | |
# TODO: dedupe build steps from publish | |
client-publish: | |
name: Publish JavaScript SDK | |
runs-on: ubuntu-latest | |
if: ${{ inputs.publish }} | |
needs: [client-build] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '19.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install wasm-pack | |
uses: jetli/wasm-pack-action@f98777369a49686b132a9e8f0fdd59837bf3c3fd | |
with: | |
version: v0.10.3 | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Run build | |
run: | | |
npm run build | |
- name: Publish to NPM | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |