Skip to content

Commit 21daba1

Browse files
committed
ci: add release action
1 parent 9fd47e2 commit 21daba1

File tree

4 files changed

+88
-4
lines changed

4 files changed

+88
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
5+
name: 'Pull Request'
6+
7+
jobs:
8+
tests:
9+
name: 'Lint and Tests'
10+
uses: ./.github/workflows/tests.yml

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- beta
6+
- +([0-9])?(.{+([0-9]),x}).x
7+
8+
name: 'Release'
9+
10+
jobs:
11+
tests:
12+
name: 'Lint and Tests'
13+
uses: ./.github/workflows/tests.yml
14+
15+
release:
16+
name: 'Publish Release'
17+
needs: [tests]
18+
runs-on: 'ubuntu-latest'
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-node@v3
22+
with:
23+
cache: npm
24+
node-version: 16
25+
- run: npm ci --no-audit
26+
- run: npm run build
27+
- uses: codfish/semantic-release-action@v2
28+
id: semantic
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
- name: 'Output new release version'
33+
if: steps.semantic.outputs.new-release-published == 'true'
34+
run: |
35+
echo "## New Release Published" >> $GITHUB_STEP_SUMMARY
36+
echo "🎉 ${{ steps.semantic.outputs.release-version }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
workflow_call:
3+
4+
name: 'Tests'
5+
6+
jobs:
7+
tests:
8+
name: 'Pull Request Checks'
9+
runs-on: 'ubuntu-latest'
10+
steps:
11+
- name: 'Check out the repo'
12+
uses: actions/checkout@v3
13+
14+
- name: 'Install Node.js'
15+
uses: actions/setup-node@v3
16+
with:
17+
cache: npm
18+
node-version: 16
19+
20+
- name: 'Install the dependencies'
21+
run: npm ci --no-audit
22+
23+
- name: 'Lint the code'
24+
run: npm run lint
25+
26+
- name: 'Add lint summary'
27+
run: |
28+
echo "## Lint results" >> $GITHUB_STEP_SUMMARY
29+
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
30+
31+
- name: 'Test run build'
32+
run: npm run build
33+
34+
- name: 'Add test summary'
35+
run: |
36+
echo "## Build results" >> $GITHUB_STEP_SUMMARY
37+
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# ethers-decode-error
22

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

6+
[gha-ci]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml
7+
[gha-badge]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml/badge.svg
68
[ts-badge]: https://img.shields.io/badge/TypeScript-5.0-blue.svg
79
[typescript-5-0]: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/
810
[license-badge]: https://img.shields.io/badge/license-Apache_2.0-blue.svg
911
[license]: https://github.com/superical/ethers-decode-error/blob/main/LICENSE
10-
[gha-ci]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml
11-
[gha-badge]: https://github.com/superical/ethers-decode-error/actions/workflows/release.yml/badge.svg
1212

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

2626
You will need to install ethers.js in your project if you have not:
27+
2728
```bash
2829
npm install ethers@^5 --save
2930
```
@@ -116,4 +117,4 @@ console.log('Custom error reason:', reason)
116117

117118
## Contributing
118119

119-
Feel free to open an issue or PR for any bugs/improvements.
120+
Feel free to open an issue or PR for any bugs/improvements.

0 commit comments

Comments
 (0)