Skip to content

Commit

Permalink
ci: add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
superical committed May 11, 2023
1 parent 9fd47e2 commit 21daba1
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
workflow_dispatch:
pull_request:

name: 'Pull Request'

jobs:
tests:
name: 'Lint and Tests'
uses: ./.github/workflows/tests.yml
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
push:
branches:
- main
- beta
- +([0-9])?(.{+([0-9]),x}).x

name: 'Release'

jobs:
tests:
name: 'Lint and Tests'
uses: ./.github/workflows/tests.yml

release:
name: 'Publish Release'
needs: [tests]
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
node-version: 16
- run: npm ci --no-audit
- run: npm run build
- uses: codfish/semantic-release-action@v2
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Output new release version'
if: steps.semantic.outputs.new-release-published == 'true'
run: |
echo "## New Release Published" >> $GITHUB_STEP_SUMMARY
echo "🎉 ${{ steps.semantic.outputs.release-version }}" >> $GITHUB_STEP_SUMMARY
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
workflow_call:

name: 'Tests'

jobs:
tests:
name: 'Pull Request Checks'
runs-on: 'ubuntu-latest'
steps:
- name: 'Check out the repo'
uses: actions/checkout@v3

- name: 'Install Node.js'
uses: actions/setup-node@v3
with:
cache: npm
node-version: 16

- name: 'Install the dependencies'
run: npm ci --no-audit

- name: 'Lint the code'
run: npm run lint

- name: 'Add lint summary'
run: |
echo "## Lint results" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: 'Test run build'
run: npm run build

- name: 'Add test summary'
run: |
echo "## Build results" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ethers-decode-error

[![TypeScript version][ts-badge]][typescript-5-0]
[![Release][gha-badge]][gha-ci] [![TypeScript version][ts-badge]][typescript-5-0]
[![License: Apache 2.0][license-badge]][license]

[gha-ci]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml
[gha-badge]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml/badge.svg
[ts-badge]: https://img.shields.io/badge/TypeScript-5.0-blue.svg
[typescript-5-0]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/
[license-badge]: https://img.shields.io/badge/license-Apache_2.0-blue.svg
[license]: https://github.com/superical/ethers-decode-error/blob/main/LICENSE
[gha-ci]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml
[gha-badge]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml/badge.svg

For those who've grappled with extracting the actual error message or reason from the JSON RPC when a transaction fails
or a smart contract reverts, you'll certainly appreciate how cumbersome it could at times.
Expand All @@ -24,6 +24,7 @@ npm install ethers-decode-error --save
```

You will need to install ethers.js in your project if you have not:

```bash
npm install ethers@^5 --save
```
Expand Down Expand Up @@ -116,4 +117,4 @@ console.log('Custom error reason:', reason)

## Contributing

Feel free to open an issue or PR for any bugs/improvements.
Feel free to open an issue or PR for any bugs/improvements.

0 comments on commit 21daba1

Please sign in to comment.