Skip to content

Commit

Permalink
Create GH Actions workflow to publish web-client to npm with provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Dec 4, 2023
1 parent 7291738 commit d95c35d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish web-client to npm
on:
push:
branches:
- soeren/web-client-package-provenance
release:
types: [created]
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
run: sudo apt-get install protobuf-compiler
- uses: jetli/[email protected]
with:
# Optional version of wasm-bindgen to install(eg. '0.2.83', 'latest')
version: 'latest'
- name: Build package
working-directory: ./web-client
run: ./scripts/build.sh
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm
- name: Publish to npm
working-directory: ./web-client/dist
run: npm publish --tag next --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.SISOU_NPM_TOKEN }}
12 changes: 10 additions & 2 deletions web-client/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ function generate() {
}

# Prepare build environment
printf "Preparing build environment...\n"
cargo install wasm-bindgen-cli wasm-opt
if ! command -v wasm-bindgen &> /dev/null
then
printf "Installing wasm-bindgen...\n"
cargo install wasm-bindgen-cli
fi
if ! command -v wasm-opt &> /dev/null
then
printf "Installing wasm-opt...\n"
cargo install wasm-opt
fi

# Primitives
compile "primitives"
Expand Down
7 changes: 0 additions & 7 deletions web-client/scripts/npm-publish.sh

This file was deleted.

0 comments on commit d95c35d

Please sign in to comment.