Skip to content

Commit e4884e2

Browse files
committed
pumb oraidex common
1 parent 1a7ec6a commit e4884e2

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: publish_package
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the main branch
6+
push:
7+
branches: [feat/permissionless-mobile]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
13+
jobs:
14+
# This workflow contains 1 job called "build"
15+
16+
build:
17+
runs-on: ubuntu-20.04
18+
strategy:
19+
matrix:
20+
node-version: ["18"]
21+
22+
steps:
23+
- name: Cancel Previous Runs
24+
uses: styfle/[email protected]
25+
with:
26+
access_token: ${{ github.token }}
27+
- uses: actions/checkout@v2
28+
- name: Use Node.js ${{ matrix.node-version }}
29+
uses: actions/setup-node@v2
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
- name: Get yarn cache directory path
33+
id: yarn-cache-dir-path
34+
run: echo "::set-output name=dir::$(yarn cache dir)"
35+
- uses: actions/cache@v4
36+
id: yarn-cache
37+
with:
38+
path: |
39+
${{ steps.yarn-cache-dir-path.outputs.dir }}
40+
./node_modules/
41+
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-yarn-
44+
- name: Install Dependencies
45+
if: steps.yarn-cache.outputs.cache-hit != 'true'
46+
run: yarn
47+
- name: Build
48+
run: yarn build
49+
- name: Authenticate with private NPM package
50+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
51+
52+
- name: Publish Oraidex Common
53+
id: publish-common
54+
continue-on-error: true
55+
run: yarn deploy:beta packages/oraidex-common
56+
env:
57+
CI: false
58+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
59+
60+
- name: send result via discord
61+
uses: appleboy/discord-action@master
62+
with:
63+
webhook_id: ${{ secrets.WEBHOOK_ID }}
64+
webhook_token: ${{ secrets.WEBHOOK_TOKEN }}
65+
username: "GitBot"
66+
message: "Repo oraidex-sdk has just published. result: ${{ steps.publish.outcome }}."

packages/oraidex-common/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@oraichain/oraidex-common",
3-
"version": "2.0.9",
3+
"version": "2.0.10-beta.1",
44
"main": "./build/index.js",
55
"module": "./build/index.js",
66
"types": "./build/index.d.ts",

packages/oraidex-common/src/helper.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,20 @@ export type RetryOptions = {
460460
export const fetchRetry = async (url: RequestInfo | URL, options: RequestInit & RetryOptions = {}) => {
461461
let retry = options.retry ?? 3;
462462
const { callback, timeout = 30000, ...init } = options;
463-
init.signal = AbortSignal.timeout(timeout);
463+
// init.signal = AbortSignal.timeout(timeout);
464+
const controller = new AbortController();
465+
const abort = setTimeout(() => {
466+
controller.abort();
467+
}, timeout);
468+
464469
while (retry > 0) {
465470
try {
466-
return await fetch(url, init);
471+
const response = await fetch(url, init);
472+
if (response) {
473+
clearTimeout(abort);
474+
}
475+
476+
return response;
467477
} catch (e) {
468478
callback?.(retry);
469479
retry--;

0 commit comments

Comments
 (0)