Skip to content

Commit 7960381

Browse files
authored
Merge pull request OneKeyHQ#33 from taimanhui/publish
chore: prepare to publish package
2 parents e77e69d + 5a1835c commit 7960381

File tree

8 files changed

+2035
-365
lines changed

8 files changed

+2035
-365
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"coverage",
1313
"commitlint.config.js",
1414
"jest.config.js",
15-
"jest-setup.js"
15+
"jest-setup.js",
16+
"example"
1617
],
1718
"plugins": ["import", "eslint-comments", "unused-imports"],
1819
"extends": [
Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,24 @@
11
name: Package & Publish
22

3-
on:
4-
pull_request:
5-
types: [closed]
3+
on: workflow_dispatch
64

75
jobs:
8-
lint-test:
9-
permissions:
10-
contents: write
11-
if: |
12-
github.event.pull_request.merged == true &&
13-
startsWith(github.event.pull_request.head.ref, 'release/')
14-
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
19-
with:
20-
node-version: '14.x'
21-
- run: yarn install --frozen-lockfile
22-
- run: yarn test
23-
- run: yarn unittest
24-
25-
package:
26-
needs: ['lint-test']
6+
npm-publish:
277
runs-on: ubuntu-latest
28-
298
steps:
309
- uses: actions/checkout@v2
31-
- uses: actions/setup-node@v1
32-
with:
33-
node-version: '14.x'
34-
- run: yarn install --frozen-lockfile
35-
- run: yarn pack
36-
- uses: actions/upload-artifact@v2
10+
- uses: actions/setup-node@v2
3711
with:
38-
name: package
39-
path: './*.tgz'
40-
41-
publish:
42-
needs: ['package']
43-
runs-on: ubuntu-latest
44-
45-
steps:
46-
- uses: actions/download-artifact@v2
47-
with:
48-
name: package
49-
50-
- uses: actions/setup-node@v1
51-
with:
52-
node-version: 14.x
53-
registry-url: https://npm.pkg.github.com/
54-
scope: '@onekeyhq'
55-
56-
- run: npm publish $(ls *.tgz)
12+
node-version: '16.x'
13+
registry-url: 'https://registry.npmjs.org'
14+
- name: Run lint & tests
15+
run: |
16+
yarn install --forzen-lockfile
17+
yarn test
18+
yarn unittest
19+
- name: Build & publish
5720
env:
58-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22+
run: |
23+
yarn build
24+
yarn publish --access public

README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,5 @@ Commit method 2 (interactively):
4949

5050
## I want to use it as a package
5151

52-
1. [Generate PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
53-
- Require `read:packages` permission only
54-
2. `cd $my_own_project`
55-
3. Add the following to your local `.npmrc`
56-
57-
```
58-
@onekeyhq:registry=https://npm.pkg.github.com
59-
//npm.pkg.github.com/:_authToken=${MY_PAT}
60-
```
61-
62-
4. `yarn add @onekeyhq/blockchain-libs`
52+
1. `cd $my_own_project`
53+
2. `yarn add @onekeyfe/blockchain-libs`

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@keyv/sqlite": "^2.0.2",
17-
"@onekeyhq/blockchain-libs": "./package/onekeyhq-blockchain-libs.tgz",
17+
"@onekeyfe/blockchain-libs": "./package/onekeyfe-blockchain-libs.tgz",
1818
"express": "^4.17.1",
1919
"http-status-codes": "^2.1.4",
2020
"keyv": "^4.0.3"

example/scripts/prepare_dev.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
mkdir -p ./package
33
cd ../
44
yarn && yarn pack
5-
mv onekeyhq-blockchain-libs-v*.tgz ./example/package/onekeyhq-blockchain-libs.tgz
5+
mv onekeyfe-blockchain-libs-v*.tgz ./example/package/onekeyfe-blockchain-libs.tgz
66

77
cd ./example || exit
88
yarn cache clean
9-
yarn add ./package/onekeyhq-blockchain-libs.tgz --force && yarn
9+
yarn add ./package/onekeyfe-blockchain-libs.tgz --force && yarn

example/src/blockchain/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BlockchainEngine } from '@onekeyhq/blockchain-libs';
1+
import { BlockchainEngine } from '@onekeyfe/blockchain-libs';
22
import { Storage } from './storage';
33

44
const config = {

0 commit comments

Comments
 (0)