Skip to content

Commit 7f59c70

Browse files
authored
chore: npm release automation (#4)
* chore: update package.json with release fields * chore: add typescript-publish action * chore: code cleanup in action workflows
1 parent 38689a1 commit 7f59c70

File tree

5 files changed

+111
-13
lines changed

5 files changed

+111
-13
lines changed

.github/workflows/go-lint.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ on:
1212
- 'go/**'
1313
- '.github/workflows/go-*.yml'
1414

15-
permissions:
16-
contents: read
17-
pull-requests: read
18-
checks: write
19-
2015
jobs:
2116
golangci:
22-
name: lint
17+
name: Lint
2318
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
checks: write
23+
2424
steps:
2525
- uses: actions/checkout@v4
2626

.github/workflows/typescript-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20-
20+
2121
- name: Setup Node.js
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: '20'
25-
25+
2626
- name: Setup pnpm
2727
uses: pnpm/action-setup@v2
2828
with:
2929
version: '9'
30-
30+
3131
- name: Install dependencies
3232
working-directory: typescript
3333
run: pnpm install
@@ -38,4 +38,4 @@ jobs:
3838

3939
- name: Type check
4040
working-directory: typescript
41-
run: pnpm tsc --noEmit
41+
run: pnpm tsc --noEmit
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: TypeScript SDK Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'ts-v*.*.*'
7+
8+
jobs:
9+
publish:
10+
name: Build and Publish
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
id-token: write # Required for provenance
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Check if tag is on main branch
20+
run: |
21+
if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/main$'; then
22+
echo "Tag is not on main branch. Aborting."
23+
exit 1
24+
fi
25+
26+
- name: Extract version from tag
27+
id: extract_version
28+
run: |
29+
# Extract version from ts-v*.*.* format
30+
TAG=${{ github.ref_name }}
31+
VERSION=${TAG#ts-v}
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '20'
38+
registry-url: 'https://registry.npmjs.org'
39+
40+
- name: Setup pnpm
41+
uses: pnpm/action-setup@v2
42+
with:
43+
version: '9'
44+
run_install: false
45+
46+
- name: Install dependencies
47+
working-directory: typescript
48+
run: pnpm install
49+
50+
- name: Run linters
51+
working-directory: typescript
52+
run: pnpm lint
53+
54+
- name: Run tests
55+
working-directory: typescript
56+
run: pnpm test
57+
58+
- name: Update version in package.json
59+
working-directory: typescript
60+
run: |
61+
# Use jq to update the version in package.json
62+
jq '.version = "${{ steps.extract_version.outputs.version }}"' package.json > package.json.tmp
63+
mv package.json.tmp package.json
64+
65+
- name: Build package
66+
working-directory: typescript
67+
run: pnpm build:prod
68+
69+
- name: Publish to NPM
70+
working-directory: typescript
71+
run: npm publish --provenance
72+
env:
73+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/typescript-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838

3939
- name: Run tests
4040
working-directory: typescript
41-
run: pnpm test
41+
run: pnpm test

typescript/package.json

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"name": "@radiustechsystems/sdk",
33
"version": "1.0.0",
4+
"description": "TypeScript SDK for interacting with the Radius Platform for smart contracts, automation, and payments",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/radiustechsystems/sdk.git"
8+
},
49
"type": "module",
510
"scripts": {
611
"build": "tsup",
@@ -16,7 +21,8 @@
1621
"test:integration:watch": "vitest integration",
1722
"change:add": "changeset add",
1823
"change:publish": "pnpm build:prod && changeset publish --no-git-tag",
19-
"change:version": "changeset version && pnpm lint:fix"
24+
"change:version": "changeset version && pnpm lint:fix",
25+
"prepublishOnly": "pnpm build:prod"
2026
},
2127
"dependencies": {
2228
"ethers": "6.13.5"
@@ -48,5 +54,24 @@
4854
"types": "./dist/index.d.ts",
4955
"files": [
5056
"dist"
51-
]
57+
],
58+
"keywords": [
59+
"radius",
60+
"evm",
61+
"automation",
62+
"contract",
63+
"payment",
64+
"transaction",
65+
"ethereum",
66+
"crypto",
67+
"sdk",
68+
"ai"
69+
],
70+
"homepage": "https://github.com/radiustechsystems/sdk/typescript#readme",
71+
"bugs": {
72+
"url": "https://github.com/radiustechsystems/sdk/issues"
73+
},
74+
"publishConfig": {
75+
"access": "public"
76+
}
5277
}

0 commit comments

Comments
 (0)