Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate json rpc engine repo #1804

Closed
wants to merge 206 commits into from
Closed
Show file tree
Hide file tree
Changes from 202 commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
0ef398e
rpc engine init commit
kumavis Sep 16, 2016
2740bd2
doc + fix returnHandlers
kumavis Sep 16, 2016
c32bc36
add response override
kumavis Sep 16, 2016
ac21066
add nesting via asMiddleware
kumavis Sep 16, 2016
6091be4
latest changes
kumavis Sep 24, 2016
4c8e2c2
test - add failing override test
kumavis Sep 29, 2016
7516779
remove override
kumavis Sep 29, 2016
304f6ef
1.0.0
kumavis Sep 29, 2016
d78cae6
meta - add repo info
kumavis Sep 29, 2016
c7f8e2c
refactor
kumavis Feb 7, 2017
4909d7f
2.0.0
kumavis Feb 7, 2017
e94b34a
asMiddleware - include in testing + more tests + copy res obj
kumavis Mar 1, 2017
93e2b72
2.1.0
kumavis Mar 1, 2017
8547b31
asMiddleware - should not error even if end not called
kumavis Apr 4, 2017
7771299
test - run tests in browser
kumavis Apr 4, 2017
286c271
2.2.0
kumavis Apr 4, 2017
d10a609
move code into src
kumavis Apr 4, 2017
6cbc358
meta - package.json add metadata
kumavis Apr 4, 2017
e74852c
meta - add aegir
kumavis Apr 4, 2017
65a3729
lint fix
kumavis Apr 4, 2017
4028c5a
lint
kumavis Apr 4, 2017
402f0c2
chore: update contributors
kumavis Apr 4, 2017
7be3712
chore: release version v2.2.1
kumavis Apr 4, 2017
fe1a389
chore: update contributors
kumavis Apr 4, 2017
d3f5230
chore: release version v2.2.2
kumavis Apr 4, 2017
1ce0da9
chore: update contributors
kumavis Apr 4, 2017
93b6ae3
chore: release version v2.2.3
kumavis Apr 4, 2017
7b800cc
meta - gitignore - dist
kumavis Apr 4, 2017
abb06e8
chore: update contributors
kumavis Apr 4, 2017
0ec3c60
chore: release version v3.0.0
kumavis Apr 4, 2017
4a15732
Update README.md
kumavis May 3, 2017
f9d4b8a
fix dropped error
kumavis Jul 13, 2017
73136e5
3.0.1
kumavis Jul 13, 2017
1e826c5
add idRemapMiddleware
kumavis Sep 6, 2017
fd8892c
3.1.0
kumavis Sep 6, 2017
22f10a1
errors - return both err first and on res obj
kumavis Sep 19, 2017
16cc5d8
3.2.0
kumavis Sep 19, 2017
e5ea32a
require result/error + asMiddleware doesnt call return handlers until…
kumavis Oct 12, 2017
ad3783d
3.1.1
kumavis Oct 12, 2017
f97b2ef
Merge branch 'master' of github.com:kumavis/json-rpc-engine
kumavis Oct 12, 2017
1ac6c27
bump aegir
kumavis Oct 12, 2017
863b894
3.3.0
kumavis Oct 12, 2017
e83353f
allow null result
kumavis Oct 12, 2017
97a7033
test - remove comment
kumavis Oct 12, 2017
5346195
3.3.1
kumavis Oct 12, 2017
f65fa8a
createAsyncMiddleware
kumavis Oct 19, 2017
13229bd
3.4.0
kumavis Oct 19, 2017
caee9ca
more explicit errors from engine
kumavis Jan 18, 2018
6e0637c
3.5.0
kumavis Jan 18, 2018
b9fa643
add createScaffoldMiddleware
kumavis Jan 18, 2018
d4b95b4
3.6.0
kumavis Jan 18, 2018
ac31b86
test - only run node tests
kumavis Jan 22, 2018
ae7f023
engine - always return res, even if error
kumavis Jan 22, 2018
f6bfc66
3.6.1
kumavis Jan 22, 2018
e460fe3
createAsyncMiddleware - handle case where middleware does not await next
kumavis May 11, 2018
8f66f81
3.6.2
kumavis May 11, 2018
c044007
engine - clone req object to prevent internal mutations from leaking
kumavis May 11, 2018
92ed8e1
3.6.3
kumavis May 11, 2018
2e2a352
add mergeMiddleware utility
kumavis May 16, 2018
fffa361
3.7.0
kumavis May 16, 2018
9fb0302
clean - remove console.log
kumavis May 17, 2018
c275d3b
3.7.1
kumavis May 17, 2018
b666240
createAsyncMiddleware - add extra logging for strange nextError
kumavis May 24, 2018
5012017
3.7.2
kumavis May 24, 2018
ade8ff7
mergeMiddleware + asMiddleware - call next handlers when request is c…
kumavis May 24, 2018
cadc57d
3.7.3
kumavis May 24, 2018
5fbd0b0
Bugfix: use spread notation to clone request object
bitpshr Sep 25, 2018
d06082d
prefer Object.assign over spread
kumavis Sep 26, 2018
a6fc14f
Merge pull request #7 from bitpshr/clone-bugfix
kumavis Sep 26, 2018
887790c
3.7.4
kumavis Sep 26, 2018
6dc03cd
deps - bump for vuln fix
kumavis Oct 4, 2018
59cab9f
test - remove logs
kumavis Oct 4, 2018
8fce54a
engine is an event emitter for notification support
kumavis Oct 4, 2018
81e69bf
3.8.0
kumavis Oct 4, 2018
2b423b9
call next returnHandler even if errors occurred
kumavis Dec 10, 2018
259c94c
4.0.0
kumavis Dec 10, 2018
3cbcb46
Update version number in package-lock.json
whymarrh Feb 15, 2019
dd27983
Organize dependencies (#9)
whymarrh Feb 15, 2019
7445972
Merge pull request #8 from whymarrh/fix-lockfile-version
kumavis Feb 16, 2019
2310e20
deps - use babelify@10
kumavis Mar 11, 2019
a172f42
5.0.0
kumavis Mar 11, 2019
d62b726
changelog note for 5.0.0
kumavis Mar 11, 2019
be70d35
Add typescript definition file (#13)
danfinlay Jun 25, 2019
2115e15
Version 5.0.1: Add type definitions
danfinlay Jun 25, 2019
bfa1825
Version 5.1.1: Include types in dist
danfinlay Jun 25, 2019
f8186c7
aegir 18.2.2 to support node 10 (#15)
rekmarks Aug 9, 2019
5f86d20
serialize errors using eth-json-rpc-errors; add .nvmrc (#14)
rekmarks Aug 9, 2019
d2353b2
update packages
rekmarks Aug 12, 2019
95df7d1
remove browserify, add babelrc
rekmarks Aug 13, 2019
e47ec51
5.1.2
rekmarks Aug 13, 2019
1bf918e
fix babelrc filename
rekmarks Aug 13, 2019
b7705a9
Merge pull request #17 from rekmarks/babelify
kumavis Aug 14, 2019
4bf6629
escalate rpc errors
rekmarks Aug 16, 2019
1961728
update eth-json-rpc-errors
rekmarks Aug 17, 2019
d3deed0
5.1.3
rekmarks Aug 17, 2019
108ba1c
Merge pull request #18 from rekmarks/errors
kumavis Aug 20, 2019
4a56870
update error serialization
rekmarks Sep 16, 2019
37d5229
5.1.4
rekmarks Sep 17, 2019
c2940e6
Merge pull request #19 from rekmarks/fix-errors
kumavis Sep 18, 2019
8005a17
Implement ordered batch requests (#20)
rekmarks Nov 8, 2019
ed36940
Version 5.1.5
danfinlay Nov 8, 2019
5b1ac11
Update package lock to 5.1.5
danfinlay Nov 8, 2019
eb65445
Update batch request behavior (#21)
rekmarks Jan 8, 2020
a21ebf1
Version-5.1.7
danfinlay Jan 8, 2020
e28bea0
Audit fixes, update packages (#28)
rekmarks Feb 10, 2020
955bfc4
Add EditorConfig file (#26)
whymarrh Feb 25, 2020
307d23f
Relax nvm version to 10 (#25)
whymarrh Feb 25, 2020
4d41b64
Switch from npm to yarn (#24)
whymarrh Feb 28, 2020
84bf812
Bump codecov from 3.5.0 to 3.6.5 (#32)
dependabot[bot] Feb 28, 2020
65ee367
Remove aegir, use @metamask/eslint-config (#33)
rekmarks Feb 29, 2020
41634fd
Use [email protected] (#34)
whymarrh Mar 19, 2020
0a51db7
Update mocha, mkdirp, & minimist (#35)
whymarrh Mar 19, 2020
c926423
Add CircleCI config (#38)
rekmarks May 14, 2020
d2d40df
Add license (#40)
rekmarks May 14, 2020
2ff3966
Add files property to package.json (#39)
rekmarks May 14, 2020
203c6a3
In-line module.exports assignments (#36)
rekmarks May 14, 2020
eb42db0
Delete .babelrc (#42)
whymarrh May 14, 2020
8564930
Use strict assert for tests (#41)
whymarrh May 14, 2020
2d42ce8
assert() -> assert.ok() (#43)
rekmarks May 14, 2020
5f3d7a8
Bump lodash from 4.17.15 to 4.17.19 (#44)
dependabot[bot] Jul 19, 2020
795ef4f
Use async/await instead of async package (#45)
rekmarks Jul 23, 2020
017b62e
Use eth-rpc-errors (#47)
rekmarks Jul 24, 2020
fab806e
Add CODEOWNERS (#48)
rekmarks Jul 24, 2020
993dda8
Remove babel (#53)
rekmarks Jul 27, 2020
d47f048
Update README (#49)
rekmarks Jul 27, 2020
59ec9e3
Fix asMiddleware implementation, add test cases (#51)
rekmarks Jul 27, 2020
d6146f0
Rationalize _promiseHandle (#54)
rekmarks Jul 27, 2020
d0ca6cb
Remove promise-to-callback, reimplement createAsyncMiddleware (#46)
rekmarks Jul 27, 2020
8d320d5
_runMiddlewares -> _runAllMiddleware (#59)
rekmarks Jul 27, 2020
ed63c0e
Add async handle signature (#55)
rekmarks Jul 27, 2020
b802fae
Factor runMiddleware into static method (#58)
rekmarks Jul 27, 2020
889c99f
Update lockfile (#60)
Gudahtt Jul 27, 2020
77a7718
Fix callback batch request handling (#61)
rekmarks Jul 27, 2020
da602b7
Full test coverage (#52)
rekmarks Jul 28, 2020
0a71be9
5.2.0 (#50)
rekmarks Jul 28, 2020
1b5d7a1
Correctly characterize async/await changes in changelog (#62)
rekmarks Jul 29, 2020
e6839bf
[email protected] (#63)
rekmarks Jul 30, 2020
b647309
5.3.0 (#64)
rekmarks Jul 30, 2020
2ad52ec
Use [email protected] (#65)
whymarrh Sep 7, 2020
f4d6930
Fix some type issues (#66)
rekmarks Oct 26, 2020
c6d49a7
Add missing types, fix remaining faulty ones (#67)
rekmarks Nov 8, 2020
2d6cc11
5.4.0 (#68)
rekmarks Nov 9, 2020
9822b1f
Migrate to TypeScript (#69)
rekmarks Nov 18, 2020
01304a6
Add runtime typecheck for request objects and return handlers, refact…
rekmarks Nov 19, 2020
613278f
Refactor internal error handling (#71)
rekmarks Nov 19, 2020
9646dc2
6.0.0 (#72)
rekmarks Nov 19, 2020
208e193
Add prepublishOnly script (#73)
rekmarks Nov 19, 2020
377f956
Use async/await and try/catch in place of Promise methods (#74)
rekmarks Nov 20, 2020
d6ee845
Add pending response type, use in middleware (#75)
rekmarks Nov 20, 2020
670d8dd
6.1.0 (#76)
rekmarks Nov 20, 2020
373bcee
resolve() function argument was missing in Promise definition (#79)
NiranjanaBinoy Dec 17, 2020
d5b6a82
Bump y18n from 4.0.0 to 4.0.1 (#85)
dependabot[bot] Mar 31, 2021
1b07633
Repo standardization (#86)
ryanml Apr 8, 2021
88c9704
Bump lodash from 4.17.19 to 4.17.21 (#87)
dependabot[bot] May 11, 2021
8ac8312
Bump hosted-git-info from 2.8.7 to 2.8.9 (#88)
dependabot[bot] May 11, 2021
2afdec6
Update ESLint and TypeScript dependencies and config (#90)
rekmarks May 18, 2021
8093345
Add type guard utilities (#91)
rekmarks May 18, 2021
172f22c
Bump glob-parent from 5.0.0 to 5.1.2 (#93)
dependabot[bot] Jun 11, 2021
37ea9bc
Bump path-parse from 1.0.6 to 1.0.7 (#95)
dependabot[bot] Aug 12, 2021
6c6edb1
Bump minimist from 1.2.5 to 1.2.6 (#99)
dependabot[bot] Apr 8, 2022
1782b14
Bump ajv from 6.10.2 to 6.12.6 (#101)
dependabot[bot] Apr 8, 2022
e91f656
Improve module template compliance (#100)
rekmarks Apr 8, 2022
e921001
Migrate to Jest (#102)
rekmarks May 16, 2022
bb04569
BREAKING: Use @metamask/utils (#105)
rekmarks May 16, 2022
8c8db16
Add `destroy` method (#106)
rekmarks May 18, 2022
9847fa0
Rename engine test file (#108)
rekmarks May 18, 2022
21fb8c4
Bump @metamask/auto-changelog from 2.5.0 to 2.6.1 (#111)
dependabot[bot] Aug 12, 2022
7f7444b
Bump @metamask/utils from 2.0.0 to 2.1.0 (#113)
dependabot[bot] Aug 12, 2022
c85af82
Handle JSON-RPC notifications (#104)
rekmarks Aug 15, 2022
5955a53
Bump @metamask/auto-changelog from 2.6.1 to 3.0.0 (#122)
dependabot[bot] Nov 8, 2022
29cc31b
Bump @metamask/auto-changelog from 3.0.0 to 3.1.0 (#125)
dependabot[bot] Nov 16, 2022
e577e58
Bump minimatch from 3.0.4 to 3.1.2 (#126)
dependabot[bot] Nov 16, 2022
5a2091c
Bump json5 from 1.0.1 to 1.0.2 (#129)
dependabot[bot] Jan 9, 2023
680c5cb
Bump @metamask/utils from 2.1.0 to 5.0.1 (#136)
dependabot[bot] Apr 12, 2023
353fccb
BREAKING: Update dependencies, fix code style, and standardise workfl…
Mrtenz Apr 12, 2023
9ed60c0
Use `@metamask/rpc-errors` (#138)
FrederikBolding Apr 13, 2023
928f496
Update README (#140)
FrederikBolding Apr 13, 2023
c753c16
7.0.0 (#141)
github-actions[bot] Apr 13, 2023
50d00fc
Revert "7.0.0" (#142)
FrederikBolding Apr 13, 2023
360d68f
Add scripts from module template (#143)
FrederikBolding Apr 13, 2023
22ff65e
7.0.0 (#144)
github-actions[bot] Apr 13, 2023
8ea82a2
Bump @metamask/utils from 5.0.1 to 5.0.2 (#149)
dependabot[bot] Apr 26, 2023
9321565
devDeps: @lavamoat/[email protected]>2.3.1 (#150)
legobeat Apr 28, 2023
53fa7cb
deps: @metamask/[email protected]>5.0.2 (#151)
legobeat Apr 28, 2023
a0df5b5
deps: @metamask/[email protected]>3.0.0 (#148)
legobeat Apr 28, 2023
bee0652
Handling an empty batch array in a request (#153)
nir11 Jun 8, 2023
60c6637
Bump semver from 6.3.0 to 6.3.1 (#154)
dependabot[bot] Jul 11, 2023
994061e
Bump word-wrap from 1.2.3 to 1.2.4 (#156)
dependabot[bot] Jul 18, 2023
7639432
7.1.0 (#155)
github-actions[bot] Jul 25, 2023
19021a2
Bump @metamask/utils from 5.0.2 to 7.0.0 (#158)
dependabot[bot] Aug 28, 2023
6007417
Bump @metamask/auto-changelog from 3.1.0 to 3.2.0 (#157)
dependabot[bot] Aug 31, 2023
0f9394a
deps: @metamask/utils@^7.0.0->^8.1.0, @metamask/rpc-errors@^5.0.0->^6…
legobeat Sep 1, 2023
21bda95
ci: run on node 20.x instead of 19.x (#167)
legobeat Sep 1, 2023
23aa8d9
7.1.1 (#166)
github-actions[bot] Sep 1, 2023
fc1ee03
Bump @metamask/auto-changelog from 3.2.0 to 3.3.0 (#168)
dependabot[bot] Sep 28, 2023
05f12ef
bump eslint packages (#169)
kanthesha Oct 5, 2023
23efd23
Bump postcss from 8.4.21 to 8.4.31 (#170)
dependabot[bot] Oct 7, 2023
df6b121
Bump @metamask/rpc-errors from 6.0.0 to 6.1.0 (#171)
dependabot[bot] Oct 11, 2023
80ae60d
Merge remote-tracking branch 'json-rpc-engine/main' into migrate-json…
kanthesha Oct 11, 2023
bd10f3a
Merge branch 'main' into migrate-json-rpc-engine-repo
kanthesha Oct 17, 2023
52decda
Merge branch 'main' into migrate-json-rpc-engine-repo
kanthesha Oct 17, 2023
ee4a628
applied eslint rules from core monorepo and fixed the errors (#172)
kanthesha Oct 18, 2023
ccdbf8e
Bump @babel/traverse from 7.21.4 to 7.23.2 (#173)
dependabot[bot] Oct 19, 2023
67c7fee
7.2.0 (#174)
github-actions[bot] Oct 19, 2023
4334115
Merge branch 'main' into migrate-json-rpc-engine-repo
kanthesha Oct 19, 2023
2f0afe3
Merge latest changes from 'json-rpc-engine/main' into migrate-json-rp…
kanthesha Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions merged-packages/json-rpc-engine/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ignores": [
"@lavamoat/allow-scripts",
"@metamask/auto-changelog",
"@types/*",
"prettier-plugin-packagejson",
"ts-node",
"typedoc",
"rimraf"
]
}
9 changes: 9 additions & 0 deletions merged-packages/json-rpc-engine/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
36 changes: 36 additions & 0 deletions merged-packages/json-rpc-engine/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
root: true,

extends: ['@metamask/eslint-config'],

overrides: [
{
files: ['*.ts'],
extends: ['@metamask/eslint-config-typescript'],
},

{
files: ['*.js'],
parserOptions: {
sourceType: 'script',
},
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['*.test.ts', '*.test.js'],
extends: [
'@metamask/eslint-config-jest',
'@metamask/eslint-config-nodejs',
],
},
],

ignorePatterns: [
'!.eslintrc.js',
'!.prettierrc.js',
'dist/',
'docs/',
'.yarn/',
],
};
8 changes: 8 additions & 0 deletions merged-packages/json-rpc-engine/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* text=auto

yarn.lock linguist-generated=false

# yarn v3
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
/.yarn/releases/** binary
/.yarn/plugins/** binary
4 changes: 4 additions & 0 deletions merged-packages/json-rpc-engine/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

* @MetaMask/devs
15 changes: 15 additions & 0 deletions merged-packages/json-rpc-engine/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
time: '06:00'
allow:
- dependency-name: '@metamask/*'
target-branch: 'main'
versioning-strategy: 'increase-if-necessary'
open-pull-requests-limit: 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build, Lint, and Test

on:
workflow_call:

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install Yarn dependencies
run: yarn --immutable

build:
name: Build
runs-on: ubuntu-latest
needs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn build
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi

lint:
name: Lint
runs-on: ubuntu-latest
needs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn lint
- name: Validate RC changelog
if: ${{ startsWith(github.head_ref, 'release/') }}
run: yarn auto-changelog validate --rc
- name: Validate changelog
if: ${{ !startsWith(github.head_ref, 'release/') }}
run: yarn auto-changelog validate
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi

test:
name: Test
runs-on: ubuntu-latest
needs:
- prepare
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn --immutable --immutable-cache
- run: yarn test
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create Release Pull Request

on:
workflow_dispatch:
inputs:
base-branch:
description: 'The base branch for git operations and the pull request.'
default: 'main'
required: true
release-type:
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
required: false
release-version:
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
required: false

jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
# This is to guarantee that the most recent tag is fetched.
# This can be configured to a more reasonable value by consumers.
fetch-depth: 0
# We check out the specified branch, which will be used as the base
# branch for all git operations and the release PR.
ref: ${{ github.event.inputs.base-branch }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- uses: MetaMask/action-create-release-pr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release-type: ${{ github.event.inputs.release-type }}
release-version: ${{ github.event.inputs.release-version }}
76 changes: 76 additions & 0 deletions merged-packages/json-rpc-engine/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Main

on:
push:
branches: [main]
pull_request:

jobs:
check-workflows:
name: Check workflows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download actionlint
id: download-actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23
shell: bash
- name: Check workflow files
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash

build-lint-test:
name: Build, lint, and test
uses: ./.github/workflows/build-lint-test.yml

all-jobs-completed:
name: All jobs completed
runs-on: ubuntu-latest
needs:
- check-workflows
- build-lint-test
outputs:
PASSED: ${{ steps.set-output.outputs.PASSED }}
steps:
- name: Set PASSED output
id: set-output
run: echo "PASSED=true" >> "$GITHUB_OUTPUT"

all-jobs-pass:
name: All jobs pass
if: ${{ always() }}
runs-on: ubuntu-latest
needs: all-jobs-completed
steps:
- name: Check that all jobs have passed
run: |
passed="${{ needs.all-jobs-completed.outputs.PASSED }}"
if [[ $passed != "true" ]]; then
exit 1
fi

is-release:
# Filtering by `push` events ensures that we only release from the `main` branch, which is a
# requirement for our npm publishing environment.
# The commit author should always be 'github-actions' for releases created by the
# 'create-release-pr' workflow, so we filter by that as well to prevent accidentally
# triggering a release.
if: github.event_name == 'push' && startsWith(github.event.head_commit.author.name, 'github-actions')
needs: all-jobs-pass
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v1
id: is-release

publish-release:
needs: is-release
if: needs.is-release.outputs.IS_RELEASE == 'true'
name: Publish release
permissions:
contents: write
uses: ./.github/workflows/publish-release.yml
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish docs to GitHub Pages

on:
workflow_call:
inputs:
destination_dir:
required: true
type: string
secrets:
PUBLISH_DOCS_TOKEN:
required: true

jobs:
publish-docs-to-gh-pages:
name: Publish docs to GitHub Pages
runs-on: ubuntu-latest
environment: github-pages
permissions:
contents: write
steps:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- name: Checkout the repository
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install npm dependencies
run: yarn --immutable
- name: Run build script
run: yarn build:docs
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
# This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository.
# Look in the repository settings under "Environments", and set this token in the `github-pages` environment.
personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }}
publish_dir: ./docs
destination_dir: ${{ inputs.destination_dir }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish main branch docs to GitHub Pages

on:
push:
branches: main

jobs:
publish-to-gh-pages:
name: Publish docs to `staging` directory of `gh-pages` branch
permissions:
contents: write
uses: ./.github/workflows/publish-docs.yml
with:
destination_dir: staging
secrets:
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish release candidate docs to GitHub Pages

on:
push:
branches: 'release/**'

jobs:
get-release-version:
name: Get release version
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.release-name.outputs.RELEASE_VERSION }}
steps:
- name: Extract release version from branch name
id: release-name
run: |
BRANCH_NAME='${{ github.ref_name }}'
echo "RELEASE_VERSION=v${BRANCH_NAME#release/}" >> "$GITHUB_OUTPUT"
publish-to-gh-pages:
name: Publish docs to `rc-${{ needs.get-release-version.outputs.release-version }}` directory of `gh-pages` branch
permissions:
contents: write
uses: ./.github/workflows/publish-docs.yml
needs: get-release-version
with:
destination_dir: rc-${{ needs.get-release-version.outputs.release-version }}
secrets:
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }}
Loading
Loading