Skip to content

Commit a0a9e32

Browse files
authored
Sdk/publish action (#462)
1 parent 0d37b0f commit a0a9e32

File tree

13 files changed

+102
-78
lines changed

13 files changed

+102
-78
lines changed

.github/workflows/publish.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish TS SDK
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish'
8+
required: true
9+
type: 'string'
10+
11+
jobs:
12+
publish-ts-sdk:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 20
20+
cache: "npm"
21+
registry-url: "https://registry.npmjs.org"
22+
- run: npm ci
23+
- run: npm run version ${{ inputs.version }}
24+
- run: npm run build --if-present
25+
- run: npm test
26+
- run: |
27+
if [[ $VERSION == *"beta"* ]]; then
28+
tag=beta
29+
elif [[ $VERSION == *"alpha"* ]]; then
30+
tag=alpha
31+
else
32+
tag=latest
33+
fi
34+
35+
npm publish --access public --tag $tag \
36+
--workspace sdk/definitions \
37+
--workspace sdk/evm \
38+
--workspace solana \
39+
--workspace sdk/route
40+
env:
41+
VERSION: ${{ inputs.version }}
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry

cli/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
},
1515
"dependencies": {
1616
"yargs": "^17.7.2"
17-
}
18-
}
17+
},
18+
"version": "0.1.0-beta.0"
19+
}

package-lock.json

+16-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ntt",
3-
"version": "0.0.1-beta.5",
3+
"version": "0.1.0-beta.0",
44
"type": "module",
55
"license": "Apache-2.0",
66
"scripts": {
@@ -14,10 +14,7 @@
1414
"test:local": "jest --config ./jest.config.ts",
1515
"generate:test": "npm run generate:test --workspaces --if-present",
1616
"build:deps": "npm run build:contracts --workspaces --if-present && npm run generate",
17-
"publish": "npm publish --access public --tag $TAG --workspace sdk/definitions --workspace sdk/evm --workspace solana --workspace sdk/route",
18-
"pub:beta": "TAG=beta npm run publish",
19-
"pub:latest": "TAG=latest npm run publish",
20-
"sync": "tsx sdk/syncVersion.ts && npm install && npm run build"
17+
"version": "tsx setSdkVersion.ts"
2118
},
2219
"devDependencies": {
2320
"@wormhole-foundation/sdk": "0.6.5",

sdk/VERSION

-1
This file was deleted.

sdk/definitions/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@wormhole-foundation/sdk-definitions-ntt",
3-
"version": "0.0.1-beta.5",
3+
"version": "0.1.0-beta.0",
44
"repository": {
55
"type": "git",
6-
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
6+
"url": "git+https://github.com/wormhole-foundation/example-native-token-transfers.git"
77
},
88
"bugs": {
9-
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
9+
"url": "https://github.com/wormhole-foundation/example-native-token-transfers"
1010
},
11-
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
11+
"homepage": "https://github.com/wormhole-foundation/example-native-token-transfers#readme",
1212
"directories": {
1313
"test": "__tests__"
1414
},

sdk/evm/package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
{
22
"name": "@wormhole-foundation/sdk-evm-ntt",
3-
"version": "0.0.1-beta.5",
3+
"version": "0.1.0-beta.0",
44
"repository": {
55
"type": "git",
6-
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
6+
"url": "git+https://github.com/wormhole-foundation/example-native-token-transfers.git"
77
},
88
"bugs": {
9-
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
9+
"url": "https://github.com/wormhole-foundation/example-native-token-transfers"
1010
},
11-
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
1211
"directories": {
13-
"test": "tests"
12+
"test": "__tests__"
1413
},
1514
"license": "Apache-2.0",
1615
"main": "./dist/cjs/index.js",
1716
"types": "./dist/cjs/index.d.ts",
1817
"module": "./dist/esm/index.js",
19-
"description": "SDK for EVM chains, used in conjunction with @wormhole-foundation/sdk",
18+
"description": "NTT SDK for EVM chains",
2019
"files": [
2120
"dist/esm",
2221
"dist/cjs"
@@ -46,7 +45,7 @@
4645
},
4746
"dependencies": {
4847
"@wormhole-foundation/sdk-connect": "0.6.5",
49-
"@wormhole-foundation/sdk-definitions-ntt": "0.0.1-beta.5",
48+
"@wormhole-foundation/sdk-definitions-ntt": "0.1.0-beta.0",
5049
"@wormhole-foundation/sdk-evm": "0.6.5",
5150
"@wormhole-foundation/sdk-evm-core": "0.6.5",
5251
"ethers": "^6.5.1"

sdk/evm/src/ethers-contracts/1_1_0/factories/NttManager__factory.ts

+1-1
Large diffs are not rendered by default.

sdk/evm/src/ethers-contracts/1_1_0/factories/WormholeTransceiver__factory.ts

+1-1
Large diffs are not rendered by default.

sdk/examples/package.json

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
{
22
"name": "@wormhole-foundation/sdk-examples-ntt",
3-
"version": "0.0.1-beta.5",
4-
"repository": {
5-
"type": "git",
6-
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
7-
},
8-
"bugs": {
9-
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
10-
},
11-
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
12-
"directories": {
13-
"test": "__tests__"
14-
},
3+
"version": "0.1.0-beta.0",
154
"license": "Apache-2.0",
165
"main": "./dist/cjs/index.js",
176
"types": "./dist/cjs/index.d.ts",
@@ -44,9 +33,9 @@
4433
},
4534
"dependencies": {
4635
"@wormhole-foundation/sdk": "0.6.5",
47-
"@wormhole-foundation/sdk-definitions-ntt": "0.0.1-beta.5",
48-
"@wormhole-foundation/sdk-evm-ntt": "0.0.1-beta.5",
49-
"@wormhole-foundation/sdk-solana-ntt": "0.0.1-beta.5",
50-
"@wormhole-foundation/sdk-route-ntt": "0.0.1-beta.5"
36+
"@wormhole-foundation/sdk-definitions-ntt": "0.1.0-beta.0",
37+
"@wormhole-foundation/sdk-evm-ntt": "0.1.0-beta.0",
38+
"@wormhole-foundation/sdk-solana-ntt": "0.1.0-beta.0",
39+
"@wormhole-foundation/sdk-route-ntt": "0.1.0-beta.0"
5140
}
5241
}

sdk/route/package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"name": "@wormhole-foundation/sdk-route-ntt",
3-
"version": "0.0.1-beta.5",
3+
"version": "0.1.0-beta.0",
44
"repository": {
55
"type": "git",
6-
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
6+
"url": "git+https://github.com/wormhole-foundation/example-native-token-transfers.git"
77
},
88
"bugs": {
9-
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
9+
"url": "https://github.com/wormhole-foundation/example-native-token-transfers"
1010
},
11-
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
11+
"homepage": "https://github.com/wormhole-foundation/example-native-token-transfers#readme",
1212
"directories": {
1313
"test": "__tests__"
1414
},
1515
"license": "Apache-2.0",
1616
"main": "./dist/cjs/index.js",
1717
"types": "./dist/cjs/index.d.ts",
1818
"module": "./dist/esm/index.js",
19-
"description": "SDK for Solana, used in conjunction with @wormhole-foundation/sdk",
19+
"description": "Implementation of a Route usable by the Wormhole SDK",
2020
"files": [
2121
"dist/esm",
2222
"dist/cjs"
@@ -25,8 +25,7 @@
2525
"wormhole",
2626
"sdk",
2727
"typescript",
28-
"ntt",
29-
"solana"
28+
"ntt"
3029
],
3130
"engines": {
3231
"node": ">=16"
@@ -46,9 +45,9 @@
4645
"ts-node": "^10.9.2"
4746
},
4847
"dependencies": {
49-
"@wormhole-foundation/sdk-definitions-ntt": "0.0.1-beta.5",
50-
"@wormhole-foundation/sdk-solana-ntt": "0.0.1-beta.5",
51-
"@wormhole-foundation/sdk-evm-ntt": "0.0.1-beta.5",
48+
"@wormhole-foundation/sdk-definitions-ntt": "0.1.0-beta.0",
49+
"@wormhole-foundation/sdk-solana-ntt": "0.1.0-beta.0",
50+
"@wormhole-foundation/sdk-evm-ntt": "0.1.0-beta.0",
5251
"@wormhole-foundation/sdk-connect": "0.6.5"
5352
},
5453
"peerDependencies": {

sdk/syncVersion.ts setSdkVersion.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ function updateVersionInPackageJson(
2323
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
2424
}
2525

26-
function getVersion(dir: string): string {
27-
const versionFilePath = path.join(dir, "sdk/VERSION");
28-
const v = fs.readFileSync(versionFilePath);
29-
return v.toString().replace("\n", "");
30-
}
31-
3226
function getPackageName(dir: string): string {
3327
const packageJsonPath = path.join(dir, "package.json");
3428
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
@@ -44,9 +38,7 @@ type Workspace = {
4438
package: string;
4539
};
4640

47-
function updateVersionsInWorkspaces(dir: string) {
48-
const version = getVersion(dir);
49-
41+
function updateVersionsInWorkspaces(dir: string, version: string) {
5042
const packageJsonPath = path.join(dir, "package.json");
5143
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
5244

@@ -70,4 +62,8 @@ function updateVersionsInWorkspaces(dir: string) {
7062
});
7163
}
7264

73-
updateVersionsInWorkspaces(path.resolve("."));
65+
const args = process.argv.slice(2);
66+
const version = args[0];
67+
if (!version) throw new Error("A version string must be provided");
68+
69+
updateVersionsInWorkspaces(path.resolve("."), version);

solana/package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
{
22
"name": "@wormhole-foundation/sdk-solana-ntt",
3-
"version": "0.0.1-beta.5",
3+
"version": "0.1.0-beta.0",
44
"repository": {
55
"type": "git",
6-
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
6+
"url": "git+https://github.com/wormhole-foundation/example-native-token-transfers.git"
77
},
88
"bugs": {
9-
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
9+
"url": "https://github.com/wormhole-foundation/example-native-token-transfers"
1010
},
11-
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
11+
12+
"homepage": "https://github.com/wormhole-foundation/example-native-token-transfers#readme",
1213
"directories": {
1314
"test": "tests"
1415
},
1516
"license": "Apache-2.0",
1617
"main": "./dist/cjs/index.js",
1718
"types": "./dist/cjs/index.d.ts",
1819
"module": "./dist/esm/index.js",
19-
"description": "SDK for Solana, used in conjunction with @wormhole-foundation/sdk",
20+
"description": "NTT SDK for Solana",
2021
"files": [
2122
"dist/esm",
2223
"dist/cjs"

0 commit comments

Comments
 (0)