Skip to content

Commit

Permalink
Add github actions publish script for npm and crates (#282)
Browse files Browse the repository at this point in the history
* Publish github actions

* README update

* Amend

* Tweaks

* Tweaks
  • Loading branch information
wjthieme authored Aug 31, 2024
1 parent bbe761a commit 75b8560
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ updates:
groups:
program-dependencies:
applies-to: version-updates
update-types: production
dependency-type: production
- package-ecosystem: "cargo"
directories:
- "rust-sdk/*"
Expand Down
35 changes: 24 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
npm:
strategy:
matrix:
package: []
package: [client]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand All @@ -21,8 +21,8 @@ jobs:
uses: ./.github/actions/anchor
with:
run: |
# TODO: Copy over keys from root package.json
cd ts-sdk/${{ matrix.package }} && yarn version $(basename ${{ github.ref }})
# TODO: replace workspace dependencies with fixed version
yarn install
yarn build ts-sdk/${{ matrix.package }} --output-style static
cd ts-sdk/${{ matrix.package }} && npm publish --access public
Expand All @@ -32,7 +32,7 @@ jobs:
cargo:
strategy:
matrix:
package: []
package: [client]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
Expand All @@ -43,23 +43,30 @@ jobs:
uses: ./.github/actions/anchor
with:
run: |
# deploy cargo
sed -i 's/^version = ".*"$/version = "$(basename ${{ github.ref }})"/' rust-sdk/${{ matrix.package }}/Cargo.toml
# TODO: replace workspace dependencies with fixed version
yarn build rust-sdk/${{ matrix.package }} --output-style static
cd rust-sdk/${{ matrix.package }} && cargo publish --allow-dirty
env:
CRATES_IO_API_TOKEN: ${{ secrets.CRATES_TOKEN }}

verifiable:
strategy:
matrix:
program: []
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deploy cargo
uses: ./.github/actions/anchor
- name: Verifiable build
run: anchor build --verifiable
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
run: |
# verifiable build and add to release
name: verifiable-build
path: |
target/deploy/*.so
target/idl/*.json
if-no-files-found: error

release:
needs: [npm, cargo, verifiable]
Expand All @@ -68,8 +75,14 @@ jobs:
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: verifiable-build
path: artifacts/
- name: Create Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
allowUpdates: true
artifacts: artifacts/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ This repository uses NX to manage the Rust and Typescript codebases. This allows
This repository is split up into sevaral parts. The following is a (non-exhaustive) list of the components and their purpose.

* **`/programs/*`** - Rust programs that are deployed on Solana.
* **`/ts-sdk/*`** (WIP) - Typescript SDKs for interacting with the programs.
* **`/rust-sdk/*`** (WIP) - Rust SDKs for interacting with the programs.
* **`/docs/*`** (WIP) - Documentation for the programs and SDKs.
* **`/ts-sdk/*`** - Typescript SDKs for interacting with the programs.
* **`/rust-sdk/*`** - Rust SDKs for interacting with the programs.
* **`/docs/*`** - Documentation for the programs and SDKs.
* **`/legacy-sdk/*`** - Legacy Typescript SDKs and integration tests.

### Commands
Expand Down
1 change: 0 additions & 1 deletion docs/legacy/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"entryPoints": ["../../legacy-sdk/whirlpool/src/index.ts"],
"entryPointStrategy": "resolve",
"githubPages": false,
"readme": "none",
"out": "dist/legacy"
}
1 change: 0 additions & 1 deletion docs/ts/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"entryPoints": ["../../ts-sdk/whirlpool/src/index.ts"],
"entryPointStrategy": "resolve",
"githubPages": false,
"readme": "none",
"out": "dist/ts"
}
10 changes: 4 additions & 6 deletions legacy-sdk/whirlpool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@
"url": "git+https://github.com/orca-so/whirlpools.git"
},
"keywords": [
"orca_so",
"orca",
"solana",
"typescript",
"sdk",
"crypto",
"dex"
"defi",
"dex",
"amm"
],
"author": "[email protected]",
"bugs": {
"url": "https://github.com/orca-so/whirlpools/issues"
},
"homepage": "https://www.orca.so"
"homepage": "https://orca.so"
}
21 changes: 1 addition & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "@orca-so/whirlpools-monorepo",
"private": true,
"license": "Apache-2.0",
"packageManager": "[email protected]",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -35,23 +34,5 @@
],
"lint-staged": {
"*": "yarn format"
},
"repository": {
"type": "git",
"url": "git+https://github.com/orca-so/whirlpools.git"
},
"keywords": [
"orca_so",
"orca",
"solana",
"typescript",
"sdk",
"crypto",
"dex"
],
"author": "[email protected]",
"bugs": {
"url": "https://github.com/orca-so/whirlpools/issues"
},
"homepage": "https://www.orca.so"
}
}
1 change: 1 addition & 0 deletions programs/whirlpool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "whirlpool"
version = "0.3.1"
publish = false
edition = "2021"

[lib]
Expand Down
8 changes: 8 additions & 0 deletions rust-sdk/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "orca_whirlpools_client"
version = "0.1.0"
description = "Rust client to interact with Orca's on-chain Whirlpool program."
include = ["src/*"]
documentation = "https://orca-so.github.io/whirlpools/"
homepage = "https://orca.so"
repository = "https://github.com/orca-so/whirlpools"
license = "Apache-2.0"
keywords = ["solana", "crypto", "defi", "dex", "amm"]
authors = ["[email protected]"]
edition = "2021"

[features]
Expand Down
1 change: 1 addition & 0 deletions rust-sdk/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Orca Whirlpools Rust Client
6 changes: 6 additions & 0 deletions rust-sdk/whirlpool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[package]
name = "orca_whirlpools"
version = "0.1.0"
description = "Orca's high-level rust sdk to interact with Orca's on-chain Whirlpool program."
documentation = "https://orca-so.github.io/whirlpools/"
homepage = "https://orca.so"
repository = "https://github.com/orca-so/whirlpools"
license = "Apache-2.0"
keywords = ["solana", "crypto", "defi", "dex", "amm"]
edition = "2021"

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions rust-sdk/whirlpool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Orca Whirlpools Rust SDK
1 change: 1 addition & 0 deletions ts-sdk/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Orca Whirlpools Typescript Client
22 changes: 20 additions & 2 deletions ts-sdk/client/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@orca-so/whirlpools-client",
"version": "0.0.1",
"description": "Typescript client to interact with Orca's on-chain Whirlpool program.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"type": "module",
"files": [
"dist",
"LICENSE"
"README.md"
],
"scripts": {
"build": "node ./kinobi.js && tsc",
Expand All @@ -24,5 +25,22 @@
"@solana/web3.js": "^2.0.0-preview.4",
"kinobi": "^0.21.4",
"typescript": "^5.5.4"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/orca-so/whirlpools.git"
},
"license": "Apache-2.0",
"keywords": [
"solana",
"crypto",
"defi",
"dex",
"amm"
],
"author": "[email protected]",
"bugs": {
"url": "https://github.com/orca-so/whirlpools/issues"
},
"homepage": "https://orca.so"
}
1 change: 1 addition & 0 deletions ts-sdk/whirlpool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Orca Whirlpools Typescript SDK
22 changes: 20 additions & 2 deletions ts-sdk/whirlpool/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@orca-so/whirlpools",
"version": "0.0.1",
"description": "Orca's high-level typescript sdk to interact with Orca's on-chain Whirlpool program.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"files": [
"dist",
"LICENSE"
"README.md"
],
"scripts": {
"build": "tsc",
Expand All @@ -17,5 +18,22 @@
},
"devDependencies": {
"typescript": "^5.5.4"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/orca-so/whirlpools.git"
},
"license": "Apache-2.0",
"keywords": [
"solana",
"crypto",
"defi",
"dex",
"amm"
],
"author": "[email protected]",
"bugs": {
"url": "https://github.com/orca-so/whirlpools/issues"
},
"homepage": "https://orca.so"
}

0 comments on commit 75b8560

Please sign in to comment.