Skip to content

Commit 5415a5e

Browse files
authored
Add npm publishing to CI/CD (#73)
* Add npm publishing to CI/CD * rebase
1 parent d75b222 commit 5415a5e

File tree

9 files changed

+3686
-687
lines changed

9 files changed

+3686
-687
lines changed

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/npm-publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release NPM package
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
release:
10+
name: NPM package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Git Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Environment
17+
uses: ./.github/actions/setup
18+
19+
- name: Build Client JS
20+
run: pnpm clients:js:build
21+
22+
- name: Create release PR or publish to npm
23+
uses: changesets/action@v1
24+
with:
25+
publish: pnpm changeset publish
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
NODE_AUTH_TOKEN: ${{ secrets.SOLANA_PROGRAM_NPM_TOKEN }}

clients/js/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# @solana-program/token-wrap
2+
3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- First stable release
8+
9+
- expose createMintTx, singleSignerWrapTx, singleSignerUnwrapTx
10+
- provide multisig-helper builders and utilities (combinedMultisigTx, escrow creation, token-account helpers)
11+
- ship generated TypeScript types, codecs, PDA finders and error maps
12+
- add GitHub-Actions & Changesets configs for automated publishing

clients/js/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# @solana-program/token-wrap
2+
3+
TypeScript client for the Solana Token Wrap program.
4+
5+
---
6+
7+
## 📦 Publishing to NPM
8+
9+
This package uses Changesets and GitHub Actions to manage versioning and publishing.
10+
11+
### 🚀 Publishing Steps
12+
13+
1. Ensure you have the [changesets CLI](https://github.com/changesets/changesets) installed.
14+
2. Create a Changeset
15+
16+
Run the following to document your changes and select a version bump:
17+
18+
```bash
19+
pnpm changeset
20+
```
21+
22+
3. Version the release (will bump the local package version and add to the changelog)
23+
24+
```bash
25+
pnpm changeset version
26+
```
27+
28+
4. Create a PR with the changes and merge! The github action will detect the difference in versions and publish
29+
automatically.

clients/js/src/examples/multisig.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import {
1111
signTransactionMessageWithSigners,
1212
} from '@solana/kit';
1313
import { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
14-
import { findWrappedMintAuthorityPda, findWrappedMintPda } from '../generated';
15-
import { multisigOfflineSignWrapTx } from '../wrap';
1614
import {
15+
findWrappedMintAuthorityPda,
16+
findWrappedMintPda,
17+
multisigOfflineSignWrapTx,
1718
combinedMultisigTx,
1819
createEscrowAccountTx,
19-
createTokenAccountTx,
20-
getOwnerFromAccount,
21-
} from '../utilities';
22-
import { createMintTx } from '../create-mint';
23-
import { multisigOfflineSignUnwrap } from '../unwrap';
20+
createMintTx,
21+
multisigOfflineSignUnwrap,
22+
} from '../index';
23+
import { createTokenAccountTx, getOwnerFromAccount } from '../utilities';
2424

2525
// Replace these consts with your own
2626
const PAYER_KEYPAIR_BYTES = new Uint8Array([

clients/js/src/examples/single-signer.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import {
88
signTransactionMessageWithSigners,
99
} from '@solana/kit';
1010
import { TOKEN_2022_PROGRAM_ADDRESS } from '@solana-program/token-2022';
11-
import { findWrappedMintPda } from '../generated';
12-
import { singleSignerWrapTx } from '../wrap';
13-
14-
import { createEscrowAccountTx, createTokenAccountTx } from '../utilities';
15-
import { createMintTx } from '../create-mint';
16-
import { singleSignerUnwrapTx } from '../unwrap';
11+
import {
12+
createEscrowAccountTx,
13+
findWrappedMintPda,
14+
createMintTx,
15+
singleSignerUnwrapTx,
16+
singleSignerWrapTx,
17+
} from '../index';
18+
import { createTokenAccountTx } from '../utilities';
1719

1820
// Replace these consts with your own
1921
const PRIVATE_KEY_PAIR = new Uint8Array([

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"clients:cli:lint": "zx ./scripts/rust/lint.mjs clients/cli"
2222
},
2323
"devDependencies": {
24+
"@changesets/cli": "^2.29.2",
2425
"@iarna/toml": "^2.2.5",
2526
"@solana-program/system": "^0.7.0",
2627
"@types/node": "^22.15.3",

0 commit comments

Comments
 (0)