Skip to content

Commit

Permalink
ci: add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rndquu committed May 20, 2024
1 parent 6cae8a0 commit f46a4aa
Show file tree
Hide file tree
Showing 6 changed files with 10,701 additions and 7,459 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Bump Version

on:
workflow_dispatch:
inputs:
bump:
description: 'bump type: major, minor or patch'
default: ''

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository code
uses: actions/checkout@v4
with:
fetch-depth: 0

# needed to use yarn v4
- name: Enable corepack
run: corepack enable

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
registry-url: https://registry.npmjs.org/

- name: Bump version
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
yarn version ${{ github.event.inputs.bump }}
git add --all
- name: Commit & Push changes
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: "chore: bump version"
32 changes: 20 additions & 12 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish-package
name: Publish Package

on:
workflow_dispatch:
Expand All @@ -7,23 +7,31 @@ on:
- main

jobs:
release-please:
publish-package:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
- name: Checkout repository code
uses: actions/checkout@v4
with:
release-type: node
package-name: "@ubiquitydao/rpc-handler"
default-branch: main
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
fetch-depth: 0

# needed to use yarn v4
- name: Enable corepack
run: corepack enable

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
registry-url: https://registry.npmjs.org/
- run: |
yarn install --immutable --immutable-cache --check-cache

- name: Build
run: |
yarn install --immutable --check-cache
yarn build
yarn pack
yarn publish --access public
- name: Publish
run: npm publish --access public
env:
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
16 changes: 16 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
nodeLinker: node-modules
supportedArchitectures:
os:
- 'current'
- 'darwin'
- 'linux'
- 'win32'
cpu:
- 'current'
- 'x64'
- 'x86'
- 'arm'
- 'ia32'
libc:
- 'current'
- 'glibc'
- 'musl'
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `@ubiquity/rpc-handler`
# `@ubiquity-dao/rpc-handler`

This packages leverages [Chainlist's](https://github.com/DefiLlama/chainlist) network RPC list to return the lowest latency provider from the list for any given network ID.

Expand All @@ -14,7 +14,7 @@ This packages leverages [Chainlist's](https://github.com/DefiLlama/chainlist) ne
## Installation

```bash
yarn add @ubiquitydao/rpc-handler
yarn add @ubiquity-dao/rpc-handler
```

## Usage
Expand All @@ -24,8 +24,8 @@ yarn add @ubiquitydao/rpc-handler
###### Browser

```typescript
import { HandlerConstructorConfig } from "@ubiquity/rpc-handler/dist/esm/src/handler";
import { RPCHandler } from "@ubiquity/rpc-handler/dist/esm/src/rpc-handler";
import { HandlerConstructorConfig } from "@ubiquity-dao/rpc-handler/dist/esm/src/handler";
import { RPCHandler } from "@ubiquity-dao/rpc-handler/dist/esm/src/rpc-handler";

export function useHandler(networkId: number) {
const config: HandlerConstructorConfig = {
Expand All @@ -49,8 +49,8 @@ app.provider = await handler.getFastestRpcProvider();
###### Node.js

```typescript
import { HandlerConstructorConfig } from "@ubiquity/rpc-handler/dist/cjs/src/handler";
import { RPCHandler } from "@ubiquity/rpc-handler/dist/cjs/src/rpc-handler";
import { HandlerConstructorConfig } from "@ubiquity-dao/rpc-handler/dist/cjs/src/handler";
import { RPCHandler } from "@ubiquity-dao/rpc-handler/dist/cjs/src/rpc-handler";

const config: HandlerConstructorConfig = {
networkId: 100;
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ubiquitydao/rpc-handler",
"name": "@ubiquity-dao/rpc-handler",
"version": "1.0.0",
"description": "Uses Chainlist's RPC collection racing them returning the lowest latency RPC",
"main": "dist/cjs/rpc-handler.js",
Expand Down Expand Up @@ -36,7 +36,8 @@
"open-source"
],
"dependencies": {
"@ethersproject/providers": "5.7.2"
"@ethersproject/providers": "5.7.2",
"node-fetch": "^3.3.2"
},
"devDependencies": {
"@babel/core": "^7.24.0",
Expand All @@ -49,6 +50,7 @@
"@cspell/dict-typescript": "^3.1.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.19",
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"cspell": "^8.4.0",
Expand Down Expand Up @@ -82,5 +84,6 @@
"extends": [
"@commitlint/config-conventional"
]
}
}
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit f46a4aa

Please sign in to comment.