Skip to content

Commit 673e759

Browse files
Merge pull request #17 from rkalis/main
Split up release process into PR + release
2 parents 06c4995 + cf45d9b commit 673e759

File tree

6 files changed

+1214
-46
lines changed

6 files changed

+1214
-46
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Create Update PR
2+
on:
3+
workflow_dispatch:
4+
# Auto-update every week on midnight Monday
5+
schedule:
6+
- cron: '0 0 * * 1'
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 16.x
15+
registry-url: 'https://registry.npmjs.org'
16+
- name: Install dependencies
17+
run: yarn
18+
- name: Generate new files
19+
run: yarn generate && yarn build
20+
- name: Update version (major if there are deletions in enums.ts, otherwise minor)
21+
run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version
22+
- name: Commit and create PR
23+
uses: peter-evans/create-pull-request@v5
24+
with:
25+
commit-message: Update chains based on latest data from chainId.network
26+
title: Update chains based on latest data from chainId.network
27+
body: Update chains based on latest data from chainId.network
28+
branch: update-chains
29+
delete-branch: true

.github/workflows/update.yml renamed to .github/workflows/publish-release.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
1-
name: Update
1+
name: Publish Release
22
on:
33
workflow_dispatch:
4-
# Auto-update every week on midnight Monday
5-
schedule:
6-
- cron: '0 0 * * 1'
4+
push:
5+
branches:
6+
- main
77
jobs:
88
update:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v2
1313
with:
14-
node-version: '12.x'
14+
node-version: 16.x
1515
registry-url: 'https://registry.npmjs.org'
1616
- name: Install dependencies
1717
run: yarn
18-
- name: Generate new files
19-
run: yarn generate && yarn build
20-
- name: Update version (major if there are deletions in enums.ts, otherwise minor)
21-
run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version
22-
- name: Commit and push changes
23-
uses: EndBug/add-and-commit@v9
24-
with:
25-
default_author: 'github_actions'
26-
message: 'Update chains based on latest data from chainId.network'
2718
- name: Publish to npm
28-
run: yarn publish
19+
run: npm publish
2920
env:
3021
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3122
- name: Get package.json info
3223
id: package_json
3324
uses: jaywcjlove/github-action-package@main
3425
- name: Create Release
35-
id: create_release
3626
uses: actions/create-release@latest
3727
env:
3828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Publish](https://github.com/taylorjdawson/eth-chains/actions/workflows/main.yml/badge.svg)](https://github.com/taylorjdawson/eth-chains/actions/workflows/main.yml) ![npm](https://img.shields.io/npm/v/eth-chains?logoColor=blue)
1+
[![Publish](https://github.com/taylorjdawson/eth-chains/actions/workflows/publish-release.yml/badge.svg)](https://github.com/taylorjdawson/eth-chains/actions/workflows/publish-release.yml/badge.svg) ![npm](https://img.shields.io/npm/v/eth-chains?logoColor=blue)
22

33
# Eth Chains
44

@@ -14,6 +14,10 @@ yarn add eth-chains
1414
npm install eth-chains
1515
```
1616

17+
### Note on versioning
18+
19+
`eth-chains` uses a weekly automated release script that updates its chain data. This release script takes breaking changes into account, so breaking changes (e.g. renamed chains) are released as a new major version, while non-breaking changes (e.g. new chains) are released as a new minor version.
20+
1721
## Usage
1822

1923
Import `chains` methods and enums:
@@ -60,7 +64,7 @@ chains.getByName('Ethereum Mainnet')
6064
### Get all Chains:
6165

6266
```ts
63-
const allChains = chains.all()
67+
const allChains = chains.all()
6468
// { 1: { name: "Ethereum Mainnet", ..., "infoURL": "https://ethereum.org" }, 2: {...}}
6569
```
6670

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eth-chains",
3-
"version": "3.0.0",
3+
"version": "2.0.0",
44
"description": "Helper module for getting Ethereum chains info.",
55
"author": "Taylor Dawson",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)