Skip to content

Commit

Permalink
Merge pull request #167 from VWBL/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
thashimoto1998 authored Sep 10, 2024
2 parents 1becdef + 89b40eb commit 33af0f5
Show file tree
Hide file tree
Showing 118 changed files with 22,486 additions and 10,586 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/**/*
.eslintrc.*
test/**/*
**/test/**/*
55 changes: 0 additions & 55 deletions .eslintrc.js

This file was deleted.

21 changes: 18 additions & 3 deletions .github/workflows/check-can-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,28 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
cache: "npm"
node-version: ${{ env.node-version }}
registry-url: "https://registry.npmjs.org"
always-auth: true

- name: Check if package version can be published
- name: Check if vwbl-core package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/core/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: yarn
PACKAGE_MANAGER: npm

- name: Check if vwbl-sdk(evm chain) package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/evm/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm

- name: Check if vwbl-sdk-xrpl package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/xrpl/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint & Test

on:
pull_request:
branches: "*"
branches: ["*"]

jobs:
ci:
Expand All @@ -19,25 +19,28 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
cache: "npm"
node-version: ${{ matrix.node-version }}

- name: Cache node_modules
uses: actions/cache@v2
id: cache_node_modules
with:
# check diff of package.json and yarn.lock
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
# check diff of package.json and package-lock.json
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
path: "**/node_modules"

- name: Install dependencies
if: steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install
run: npm install

- name: Build
run: npm run build:all

- name: Lint
run: yarn lint
run: npm run lint:all

- name: Test
run: yarn test
run: npm run test:evm
env:
PROVIDER_URL: https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }}
155 changes: 108 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,139 @@
name: Publish npm package

on:
pull_request:
push:
branches:
- master
types: [closed]
tags:
- '*'

env:
# Check available versions below
# https://github.com/actions/node-versions/blob/main/versions-manifest.json
node-version: "20.x"

jobs:
publish:
if: github.event.pull_request.merged == true
setup:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "yarn"
node-version: ${{ env.node-version }}
registry-url: "https://registry.npmjs.org"
always-auth: true

- name: Cache node_modules
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v2
id: cache_node_modules
with:
# check diff of package.json and yarn.lock
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
path: "**/node_modules"
# キャッシュキー完全一致しない場合 npm installする必要があるのでrestore-keysは使わない
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
path: '**/node_modules'

- name: Install dependencies
- name: Install Dependencies
if: steps.cache_node_modules.outputs.cache-hit != 'true'
run: yarn install --immutable
run: npm install

publish-core&evm&xrpl:
if: contains(github.ref, 'tags/core')
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
path: '**/node_modules'
- name: Build
run: yarn build

# - name: Bump version and push tag
# id: tag_version
# uses: mathieudutour/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Check if package version can be published
run: npm run build:all
- name: Check if vwbl-core package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/core/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: yarn

- name: Get new package version
id: package-version
uses: martinbeentjes/npm-get-version-action@main

- name: Create tag
uses: rickstaa/action-create-tag@v1
PACKAGE_MANAGER: npm
- name: Check if vwbl-sdk(evm chain) package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/evm/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm
- name: Check if vwbl-sdk-xrpl package version can be published
uses: technote-space/package-version-check-action@v1
with:
tag: ${{ steps.package-version.outputs.current-version }}
message: Released ${{ steps.package-version.outputs.current-version }}
PACKAGE_DIR: 'packages/xrpl/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm
- name: Publish vwbl-core package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc && npm run publish:core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Publish vwbl-sdk(evm chain) package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc && npm run publish:evm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Publish vwbl-sdk-xrpl package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc && npm run publish:xrpl
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}

- name: Create a GitHub release
uses: ncipollo/release-action@v1
publish-evm:
if: contains(github.ref, 'tags/evm')
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
id: setup-node
with:
node-version: ${{ env.node-version }}
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v2
with:
tag: ${{ steps.package-version.outputs.current-version }}
name: ${{ github.event.pull_request.title }}
body: ${{ github.event.pull_request.body }}
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
path: '**/node_modules'
- name: Build
run: npm run build:all
- name: Check if vwbl-sdk(evm chain) package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/evm/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm
- name: Publish vwbl-sdk(evm chain) package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc && npm run publish:evm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}

- name: Publish npm package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc && yarn publish
publish-xrpl:
if: contains(github.ref, 'tags/xrpl')
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: 'npm'
- name: node_modules cache
uses: actions/cache@v2
with:
key: ${{ runner.os }}-build-node_modules-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/package.json') }}
path: '**/node_modules'
- name: Build
run: npm run build:all
- name: Check if vwbl-sdk-xrpl package version can be published
uses: technote-space/package-version-check-action@v1
with:
PACKAGE_DIR: 'packages/xrpl/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_MANAGER: npm
- name: Publish vwbl-sdk-xrpl package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc && npm run publish:xrpl
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
node_modules
.idea
dist
.env
.DS_Store

# yarn
.yarn/*
!.yarn/releases
!.yarn/plugins
.nx/installation
.nx/cache
.nx/workspace-data

.DS_Store
Loading

0 comments on commit 33af0f5

Please sign in to comment.