Skip to content

Commit

Permalink
Merge pull request #17 from rkalis/main
Browse files Browse the repository at this point in the history
Split up release process into PR + release
  • Loading branch information
taylorjdawson committed May 31, 2023
2 parents 06c4995 + cf45d9b commit 673e759
Show file tree
Hide file tree
Showing 6 changed files with 1,214 additions and 46 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/create-update-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Create Update PR
on:
workflow_dispatch:
# Auto-update every week on midnight Monday
schedule:
- cron: '0 0 * * 1'
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn
- name: Generate new files
run: yarn generate && yarn build
- name: Update version (major if there are deletions in enums.ts, otherwise minor)
run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version
- name: Commit and create PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update chains based on latest data from chainId.network
title: Update chains based on latest data from chainId.network
body: Update chains based on latest data from chainId.network
branch: update-chains
delete-branch: true
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
name: Update
name: Publish Release
on:
workflow_dispatch:
# Auto-update every week on midnight Monday
schedule:
- cron: '0 0 * * 1'
push:
branches:
- main
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12.x'
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn
- name: Generate new files
run: yarn generate && yarn build
- name: Update version (major if there are deletions in enums.ts, otherwise minor)
run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
with:
default_author: 'github_actions'
message: 'Update chains based on latest data from chainId.network'
- name: Publish to npm
run: yarn publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get package.json info
id: package_json
uses: jaywcjlove/github-action-package@main
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![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)
[![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)

# Eth Chains

Expand All @@ -14,6 +14,10 @@ yarn add eth-chains
npm install eth-chains
```

### Note on versioning

`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.

## Usage

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

```ts
const allChains = chains.all()
const allChains = chains.all()
// { 1: { name: "Ethereum Mainnet", ..., "infoURL": "https://ethereum.org" }, 2: {...}}
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eth-chains",
"version": "3.0.0",
"version": "2.0.0",
"description": "Helper module for getting Ethereum chains info.",
"author": "Taylor Dawson",
"main": "dist/index.js",
Expand Down
Loading

0 comments on commit 673e759

Please sign in to comment.