Skip to content

SN Release process

Zike Yang edited this page Nov 25, 2022 · 14 revisions

This page contains instructions for how to perform an streamnative release.

Making the release

The steps for releasing are as follows:

  1. Create the release branch
  2. Change path on the package.json
  3. Create Release and tag
  4. Publish binaries napi to release.
  5. Publish source to npm of sn-pulsar-client
  6. How to use.

1. Create the release branch

$ git clone git@github.com:streamnative/pulsar-client-node.git
$ cd pulsar-client-node
$ git checkout -b branch-1.X.X origin/master

2. Change path on the package.json

You need to point the relevant path to the streamnative repository

git checkout branch-1.X.X

Apply this patch, and change the version:

diff --git a/build-support/download-release-artifacts.py b/build-support/download-release-artifacts.py
--- a/build-support/download-release-artifacts.py	(revision 1e834bf20c0d58a87a3c9af8e775f5c703bf0970)
+++ b/build-support/download-release-artifacts.py	(date 1669366248888)
@@ -33,7 +33,7 @@
 GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
 
 ACCEPT_HEADER = 'application/vnd.github+json'
-LIST_URL = 'https://api.github.com/repos/apache/pulsar-client-node/actions/runs/%d/artifacts'
+LIST_URL = 'https://api.github.com/repos/streamnative/pulsar-client-node/actions/runs/%d/artifacts'
 
 workflow_run_id = int(sys.argv[1])
 dest_path = sys.argv[2]
Index: package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/package.json b/package.json
--- a/package.json	(revision 1e834bf20c0d58a87a3c9af8e775f5c703bf0970)
+++ b/package.json	(date 1669366377688)
@@ -1,7 +1,7 @@
 {
-  "name": "pulsar-client",
-  "version": "1.8.0-rc.0",
-  "description": "Pulsar Node.js client",
+  "name": "sn-pulsar-client",
+  "version": "1.X.X-X",
+  "description": "StreamNative Pulsar Node.js client",
   "main": "index.js",
   "types": "index.d.ts",
   "directories": {
@@ -23,7 +23,7 @@
   },
   "repository": {
     "type": "git",
-    "url": "https://github.com/apache/pulsar-client-node.git"
+    "url": "https://github.com/streamnative/pulsar-client-node.git"
   },
   "homepage": "https://pulsar.apache.org/docs/en/client-libraries-node",
   "author": "Apache Software Foundation",
@@ -61,8 +61,8 @@
   "binary": {
     "module_name": "Pulsar",
     "module_path": "./lib/binding/",
-    "host": "https://dist.apache.org/repos/dist/release/pulsar/pulsar-client-node/",
-    "remote_path": "pulsar-client-node-{version}",
+    "host": "https://github.com/streamnative/pulsar-client-node/releases/download/",
+    "remote_path": "v{version}",
     "package_name": "napi-{platform}-{libc}-{arch}.tar.gz"
   },
   "license-check-and-add-config": {

Commit this change.

$ git add .
$ git commit -m 'Release v1.X.X-X'
$ git push origin branch-1.X.X

3. Create Release and tag

Create v1.X.X-X releases and tags based on branch-1.x.x

https://github.com/streamnative/pulsar-client-node/releases/new

4. Publish binaries napi to release.

When the build is pushed to the Streamnative repo, a Github action job will run and build all the binary artifacts.

The build will be available at https://github.com/streamnative/pulsar-client-node/actions

Once the workflow is completed (ETA ~20 min), the artifacts will be available for download.

Record the id of the workflow as WORKFLOW_ID.

Download these binaries by following the steps below and uploading them to the release page.

# Generate token from here: https://github.com/settings/tokens
$ export GITHUB_TOKEN=${Your GitHub token} 
$ mkdir binaries-files
# Download all binaries from the action artifacts.
$ python build-support/download-release-artifacts.py $WORKFLOW_ID binaries-files
$ wget https://raw.githubusercontent.com/streamnative/pulsar-client-node/branch-release/build-support/upload-napi-release.py
$ upload-napi-release.py v1.X.X-X binaries-files

You should see these files on the release page, like this: https://github.com/streamnative/pulsar-client-node/releases/tag/v1.7.0-1

5. Publish source to npm of sn-pulsar-client

# Create or verify a user account in the npm registry
$ npm adduser

Username: foobar
Password: ********
Email: (this IS public) foobar@streamnative.io

# Publish the package to the npm registry
$ npm publish

# If you don't have permission to publish `sn-pulsar-client` to the npm registry,
# ask other maintainers(@shibd, @guangning, @zike) to grant that permission.

6. How to use.

npm install sn-pulsar-client@1.X.X.X