-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK Publish and compatibility with Front-end (#152)
Added sdk publish to npm for consumption by borrow front-end and added necessary compatibility changes --------- Co-authored-by: Cristian Dascalu <cristi.dascalu@gmail.com> Co-authored-by: Roberto Cano <3525807+robercano@users.noreply.github.com>
- Loading branch information
1 parent
083d6a9
commit 0837828
Showing
22 changed files
with
396 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Publish Client Package | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
npm_access_token: | ||
required: true | ||
type: secret | ||
version_changed: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
publish-client-package: | ||
if: ${{ inputs.version_changed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
corepack: true | ||
|
||
- name: Install pnpm | ||
run: corepack enable && corepack prepare pnpm@latest --activate | ||
|
||
- name: Install dependencies with pnpm | ||
run: pnpm i | ||
|
||
- name: Build with pnpm | ||
run: pnpm build | ||
|
||
- name: Publish package with pnpm | ||
run: pnpm publish:npm | ||
working-directory: sdk/sdk-client | ||
env: | ||
NPM_ACCESS_TOKEN: ${{ inputs.npm_access_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Publish Common Package | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
npm_access_token: | ||
required: true | ||
type: secret | ||
version_changed: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
publish-common-package: | ||
if: ${{ inputs.version_changed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
corepack: true | ||
|
||
- name: Install pnpm | ||
run: corepack enable && corepack prepare pnpm@latest --activate | ||
|
||
- name: Install dependencies with pnpm | ||
run: pnpm i | ||
|
||
- name: Build with pnpm | ||
run: pnpm build | ||
|
||
- name: Publish package with pnpm | ||
run: pnpm publish:npm | ||
working-directory: sdk/sdk-common | ||
env: | ||
NPM_ACCESS_TOKEN: ${{ inputs.npm_access_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Publish Packages | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: false | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch name' | ||
required: true | ||
type: choice | ||
options: | ||
- 'main' | ||
- 'dev' | ||
publish_option: | ||
description: 'Select package(s) to publish' | ||
required: true | ||
type: choice | ||
options: | ||
- 'common' | ||
- 'client' | ||
- 'all' | ||
|
||
jobs: | ||
prepare: | ||
name: Prepare | ||
runs-on: ubuntu-latest | ||
outputs: | ||
common_changed: ${{ steps.common-version-check.outputs.changed }} | ||
client_changed: ${{ steps.client-version-check.outputs.changed }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
ref: ${{ github.event.inputs.branch || github.ref_name }} | ||
- id: common-version-check | ||
run: | | ||
if git diff HEAD^ HEAD -- sdk/sdk-common/bundle/package.json | grep '"version":'; then | ||
echo "::set-output name=changed::true" | ||
else | ||
echo "::set-output name=changed::false" | ||
fi | ||
- id: client-version-check | ||
run: | | ||
if git diff HEAD^ HEAD -- sdk/sdk-client/bundle/package.json | grep '"version":'; then | ||
echo "::set-output name=changed::true" | ||
else | ||
echo "::set-output name=changed::false" | ||
fi | ||
publish-common: | ||
needs: prepare | ||
if: >- | ||
(needs.prepare.outputs.common_changed == 'true') && | ||
((github.event.inputs.publish_option == 'common') || (github.event.inputs.publish_option == 'all')) | ||
uses: ./.github/workflows/publish-common-package.yaml | ||
with: | ||
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }} | ||
version_changed: ${{ needs.prepare.outputs.common_changed }} | ||
|
||
publish-client: | ||
needs: prepare | ||
if: >- | ||
(needs.prepare.outputs.client_changed == 'true') && | ||
((github.event.inputs.publish_option == 'client') || (github.event.inputs.publish_option == 'all')) | ||
uses: ./.github/workflows/publish-client-package.yaml | ||
with: | ||
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }} | ||
version_changed: ${{ needs.prepare.outputs.client_changed }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Publish Packages | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: false | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'sdk/sdk-common/bundle/package.json' | ||
- 'sdk/sdk-client/bundle/package.json' | ||
|
||
jobs: | ||
prepare: | ||
name: Prepare | ||
runs-on: ubuntu-latest | ||
outputs: | ||
common_changed: ${{ steps.common-version-check.outputs.changed }} | ||
client_changed: ${{ steps.client-version-check.outputs.changed }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- id: common-version-check | ||
run: | | ||
if git diff HEAD^ HEAD -- sdk/sdk-common/bundle/package.json | grep '"version":'; then | ||
echo "::set-output name=changed::true" | ||
else | ||
echo "::set-output name=changed::false" | ||
fi | ||
- id: client-version-check | ||
run: | | ||
if git diff HEAD^ HEAD -- sdk/sdk-client/bundle/package.json | grep '"version":'; then | ||
echo "::set-output name=changed::true" | ||
else | ||
echo "::set-output name=changed::false" | ||
fi | ||
publish-common: | ||
needs: prepare | ||
if: ${{ needs.prepare.outputs.common_changed == 'true' }} | ||
uses: ./.github/workflows/publish-common-package.yaml | ||
with: | ||
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }} | ||
version_changed: ${{ needs.prepare.outputs.common_changed }} | ||
|
||
publish-client: | ||
needs: prepare | ||
if: ${{ needs.prepare.outputs.client_changed == 'true' }} | ||
uses: ./.github/workflows/publish-client-package.yaml | ||
with: | ||
npm_access_token: ${{ secrets.NPM_ACCESS_TOKEN }} | ||
version_changed: ${{ needs.prepare.outputs.client_changed }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ artifacts | |
.vscode | ||
|
||
# private http envs | ||
*.private.env.json | ||
*.private.env.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "summerfi-protocol-plugins", | ||
"version": "0.0.9", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"packageManager": "yarn@1.22.21", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@summerfi/sdk-common": "workspace:*", | ||
"@summerfi/deployment-utils": "workspace:*", | ||
"@summerfi/deployment-types": "workspace:*", | ||
"@summerfi/protocol-plugins-common": "workspace:*", | ||
"@summerfi/testing-utils": "workspace:*", | ||
"@summerfi/swap-common": "workspace:*", | ||
"bignumber.js": "9.0.1", | ||
"zod": "^3.22.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './plugins/aave-v3' | ||
export * from './plugins/spark' | ||
export * from './plugins/maker' | ||
export * from './plugins/common' | ||
export * from './implementation' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "summerfi-sdk-client", | ||
"version": "0.0.9", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"packageManager": "yarn@1.22.21", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@trpc/client": "11.0.0-next-beta.264", | ||
"bignumber.js": "^9.1.2", | ||
"superjson": "^1.13.3", | ||
"viem": "^2.7.9" | ||
} | ||
} |
Oops, something went wrong.