Skip to content

Commit

Permalink
ci(typescript-sdk): implement github action to publish npm package (#124
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fbozic authored Apr 11, 2024
1 parent 6d8b912 commit 38f513e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/calimero_sdk_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Calimero SDK

on:
push:
branches:
- master
- feat/typescript-sdk-npm-publish-automation
paths:
- "packages/calimero-sdk/**"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm buildSdk

- name: Change to Calimero SDK Directory
run: cd packages/calimero-sdk

- name: Setup .npmrc file to publish to npm
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish
run: pnpm publish --access public
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "@calimero-p2p-sdk/monorepo",
"name": "@calimero-is-near/monorepo",
"private": true,
"engines": {
"node": ">=18.19.0",
"pnpm": ">=7"
"pnpm": ">=8"
},
"scripts": {
"release": "changeset publish",
"buildSdk": "pnpm install && cd packages/calimero-sdk && pnpm build"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/calimero-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "calimero-p2p-sdk",
"version": "0.0.1",
"version": "0.0.2",
"description": "Javascript library to interact with Calimero node",
"type": "module",
"main": "lib/index.js",
Expand Down

0 comments on commit 38f513e

Please sign in to comment.