mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-18 05:24:25 +01:00
Wasm publish (#815)
* Add Wasm CI publishing * Add Deno dummy * Add missing mkdir for deno * Don't build dummies as we need the javascript interaces generating
This commit is contained in:
67
.github/workflows/build-bindings-wasm.yml
vendored
Normal file
67
.github/workflows/build-bindings-wasm.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
name: Build bindings for Wasm
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'commit/tag/branch reference'
|
||||
required: true
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
repository:
|
||||
description: 'sdk repository, defaults to current repository'
|
||||
required: false
|
||||
type: string
|
||||
ref:
|
||||
description: 'commit/tag/branch reference'
|
||||
required: true
|
||||
type: string
|
||||
use-dummy-binaries:
|
||||
description: 'If true, creates dummy binaries rather than real binaries'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: build wasm
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
repository: ${{ inputs.repository || github.repository }}
|
||||
|
||||
- name: Install Wasm target
|
||||
run: rustup target add wasm32-unknown-unknown
|
||||
|
||||
- name: Install wasm-pack
|
||||
run: cargo install wasm-pack
|
||||
|
||||
- name: Install Protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
version: "27.2"
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup emsdk
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: lib
|
||||
|
||||
- name: Build Wasm packages
|
||||
working-directory: lib/wasm
|
||||
run: make build
|
||||
|
||||
- name: Remove gitignore files
|
||||
working-directory: lib/wasm/pkg
|
||||
run: rm -f **/.gitignore
|
||||
|
||||
- name: Archive release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bindings-wasm
|
||||
path: lib/wasm/pkg
|
||||
29
.github/workflows/publish-all-platforms.yml
vendored
29
.github/workflows/publish-all-platforms.yml
vendored
@@ -47,7 +47,7 @@ on:
|
||||
description: 'array of packages to publish (remove what you do not want)'
|
||||
required: true
|
||||
type: string
|
||||
default: '["csharp", "golang", "maven", "kotlin-multiplatform", "flutter", "react-native", "python", "swift"]'
|
||||
default: '["csharp", "golang", "maven", "kotlin-multiplatform", "flutter", "react-native", "python", "swift", "wasm"]'
|
||||
csharp-ref:
|
||||
description: 'optional commit/tag/branch reference for the C# project. Defaults to ref.'
|
||||
required: false
|
||||
@@ -79,6 +79,7 @@ jobs:
|
||||
react-native-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'react-native') && inputs.package-version) || '' }}
|
||||
python-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'python') && inputs.package-version) || '' }}
|
||||
swift-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'swift') && inputs.package-version) || '' }}
|
||||
wasm-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'wasm') && inputs.package-version) || '' }}
|
||||
use-dummy-binaries: ${{ inputs.use-dummy-binaries }}
|
||||
publish: ${{ inputs.publish }}
|
||||
steps:
|
||||
@@ -100,6 +101,7 @@ jobs:
|
||||
bindings-linux: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }}
|
||||
bindings-android: ${{ !!needs.pre-setup.outputs.kotlin-multiplatform-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.golang-package-version }}
|
||||
bindings-ios: ${{ !!needs.pre-setup.outputs.kotlin-multiplatform-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.swift-package-version }}
|
||||
bindings-wasm: ${{ !!needs.pre-setup.outputs.wasm-package-version }}
|
||||
kotlin: ${{ !!needs.pre-setup.outputs.kotlin-multiplatform-package-version || !!needs.pre-setup.outputs.maven-package-version }}
|
||||
swift: ${{ !!needs.pre-setup.outputs.swift-package-version || !!needs.pre-setup.outputs.flutter-package-version }}
|
||||
python: ${{ !!needs.pre-setup.outputs.python-package-version }}
|
||||
@@ -109,6 +111,7 @@ jobs:
|
||||
kotlin-multiplatform: ${{ !!needs.pre-setup.outputs.kotlin-multiplatform-package-version }}
|
||||
flutter: ${{ !!needs.pre-setup.outputs.flutter-package-version }}
|
||||
react-native: ${{ !!needs.pre-setup.outputs.react-native-package-version }}
|
||||
wasm: ${{ !!needs.pre-setup.outputs.wasm-package-version }}
|
||||
ref: ${{ needs.pre-setup.outputs.ref }}
|
||||
csharp-package-version: ${{ needs.pre-setup.outputs.csharp-package-version || '0.0.2' }}
|
||||
csharp-ref: ${{ needs.pre-setup.outputs.csharp-ref }}
|
||||
@@ -119,6 +122,7 @@ jobs:
|
||||
react-native-package-version: ${{ needs.pre-setup.outputs.react-native-package-version || '0.0.2' }}
|
||||
python-package-version: ${{ needs.pre-setup.outputs.python-package-version || '0.0.2' }}
|
||||
swift-package-version: ${{ needs.pre-setup.outputs.swift-package-version || '0.0.2' }}
|
||||
wasm-package-version: ${{ needs.pre-setup.outputs.wasm-package-version || '0.0.2' }}
|
||||
publish: ${{ needs.pre-setup.outputs.publish }}
|
||||
use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }}
|
||||
uniffi-25: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.kotlin-multiplatform-package-version || !!needs.pre-setup.outputs.maven-package-version }}
|
||||
@@ -175,6 +179,15 @@ jobs:
|
||||
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
|
||||
uniffi-25: ${{ needs.setup.outputs.uniffi-25 == 'true' }}
|
||||
|
||||
build-bindings-wasm:
|
||||
needs: setup
|
||||
if: ${{ needs.setup.outputs.bindings-wasm == 'true' }}
|
||||
uses: ./.github/workflows/build-bindings-wasm.yml
|
||||
with:
|
||||
repository: ${{ needs.setup.outputs.repository }}
|
||||
ref: ${{ needs.setup.outputs.ref }}
|
||||
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
|
||||
|
||||
build-language-bindings:
|
||||
needs: setup
|
||||
uses: ./.github/workflows/build-language-bindings.yml
|
||||
@@ -334,3 +347,17 @@ jobs:
|
||||
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
|
||||
SWIFT_RELEASE_TOKEN: ${{ secrets.SWIFT_RELEASE_TOKEN }}
|
||||
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
|
||||
|
||||
publish-wasm:
|
||||
needs:
|
||||
- setup
|
||||
- build-bindings-wasm
|
||||
if: ${{ needs.setup.outputs.wasm == 'true' }}
|
||||
uses: ./.github/workflows/publish-wasm.yml
|
||||
with:
|
||||
repository: ${{ needs.setup.outputs.repository }}
|
||||
ref: ${{ needs.setup.outputs.ref }}
|
||||
package-version: ${{ needs.setup.outputs.wasm-package-version }}
|
||||
publish: ${{ needs.setup.outputs.publish == 'true' }}
|
||||
secrets:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
73
.github/workflows/publish-wasm.yml
vendored
Normal file
73
.github/workflows/publish-wasm.yml
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
name: Publish Wasm Package
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
repository:
|
||||
description: 'sdk repository, defaults to current repository'
|
||||
required: false
|
||||
type: string
|
||||
ref:
|
||||
description: 'commit/tag/branch reference'
|
||||
required: true
|
||||
type: string
|
||||
package-version:
|
||||
description: 'version for the npm package (MAJOR.MINOR.BUILD)'
|
||||
required: true
|
||||
type: string
|
||||
publish:
|
||||
description: 'value indicating whether to publish to npm.'
|
||||
required: true
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
NPM_TOKEN:
|
||||
description: 'access token for npm publish'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build-package:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout breez-sdk-liquid repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ inputs.repository || github.repository }}
|
||||
ref: ${{ inputs.ref || github.sha }}
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
scope: '@breeztech'
|
||||
|
||||
- name: Download wasm bindings
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bindings-wasm
|
||||
path: packages/wasm
|
||||
|
||||
- name: Remove unpublished files
|
||||
working-directory: packages/wasm
|
||||
run: rm -rf examples makefile DEVELOPMENT.md PUBLISHING.md
|
||||
|
||||
- name: Make sure we publish the version as specified
|
||||
working-directory: packages/wasm
|
||||
run: npm --no-git-tag-version --allow-same-version version ${{ inputs.package-version || '0.0.2' }}
|
||||
|
||||
- name: Pack for archival
|
||||
working-directory: packages/wasm
|
||||
run: yarn pack --filename breez-sdk-liquid.tgz
|
||||
|
||||
- name: Archive the package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wasm-${{ inputs.package-version || '0.0.2' }}
|
||||
path: packages/wasm/breez-sdk-liquid.tgz
|
||||
|
||||
- name: Publish package to npm
|
||||
if: ${{ inputs.publish }}
|
||||
working-directory: packages/wasm
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: yarn publish
|
||||
Reference in New Issue
Block a user