-
Notifications
You must be signed in to change notification settings - Fork 3
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
ZK-1337: Publish packages to npm #87
Changes from all commits
fd1f4af
2f9710c
df4e2a0
7cad5f8
d120a71
b11ac7f
e4ea7f5
9d45bed
0f26240
c49d03b
1243512
d8f3093
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
name: "Build and publish packages to npm" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package: | ||
description: "Package to publish" | ||
required: true | ||
type: choice | ||
options: | ||
- shielder-sdk | ||
- shielder-sdk-crypto | ||
- shielder-sdk-crypto-wasm | ||
tag: | ||
description: "NPM tag" | ||
required: true | ||
type: choice | ||
options: | ||
- develop | ||
- latest | ||
|
||
jobs: | ||
publish: | ||
name: Build and push ${{ github.event.inputs.package }} | ||
runs-on: [self-hosted, Linux, X64, medium] | ||
steps: | ||
- name: GIT | Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Rust setup for shielder-sdk-crypto-wasm and shielder-sdk | ||
- name: Prepare Rust env | ||
if: | | ||
github.event.inputs.package == 'shielder-sdk-crypto-wasm' || | ||
github.event.inputs.package == 'shielder-sdk' | ||
uses: ./.github/actions/prepare-rust-env | ||
with: | ||
poseidon-gadget-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
zkos-circuits-private-key: ${{ secrets.ZKOS_CIRCUITS_SSH_PRIVATE_KEY }} | ||
|
||
- name: Install wasm-pack | ||
if: github.event.inputs.package == 'shielder-sdk-crypto-wasm' | ||
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | ||
|
||
# Foundry setup for shielder-sdk | ||
- name: Install Foundry | ||
if: github.event.inputs.package == 'shielder-sdk' | ||
uses: foundry-rs/[email protected] | ||
with: | ||
cache-key: custom-seed-coverage-${{ github.ref_name }} | ||
cache-restore-keys: |- | ||
contract-suite | ||
version: nightly-31dd1f77fd9156d09836486d97963cec7f555343 | ||
|
||
- name: Install deps and compile contracts | ||
if: github.event.inputs.package == 'shielder-sdk' | ||
run: | | ||
make deps | ||
make compile-contracts | ||
|
||
# Common Node.js setup | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 23 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: latest | ||
|
||
# Build steps | ||
- name: Build shielder-wasm | ||
if: github.event.inputs.package == 'shielder-sdk-crypto-wasm' | ||
run: make all | ||
working-directory: crates/shielder-wasm | ||
|
||
- name: Install dependencies (workspace) | ||
run: pnpm install-deps | ||
working-directory: ts | ||
|
||
- name: Build package | ||
run: | | ||
if [ "${{ github.event.inputs.package }}" = "shielder-sdk" ]; then | ||
pnpm build-package:sdk | ||
elif [ "${{ github.event.inputs.package }}" = "shielder-sdk-crypto" ]; then | ||
pnpm build-package:crypto | ||
else | ||
pnpm build-package:crypto-wasm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: you could handle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I believe the best scenario is to have separate jobs declarations for each package. but now let's keep it simple |
||
fi | ||
working-directory: ts | ||
|
||
# Publish | ||
- name: Add .npmrc with publish token | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISHING_KEY }}" > .npmrc | ||
working-directory: ts/${{ github.event.inputs.package }} | ||
|
||
- name: Publish package | ||
run: pnpm publish --access restricted --no-git-checks --tag ${{ github.event.inputs.tag }} | ||
working-directory: ts/${{ github.event.inputs.package }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just making sure that
develop
is an actual tag and not a misspelling ofdevelopment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an actual tag