-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add light client compatible and change to json. (#2916)
* feat: Add light client compatible and change to json. * fix: update compatible.json as fs.write * fix: Use compatible.json and add action to update it.
- Loading branch information
Showing
9 changed files
with
218 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Update Neuron compatibility table | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'rc/**' | ||
paths: | ||
- 'package.json' | ||
|
||
jobs: | ||
update-neuron-compatible: | ||
name: Update Neuron compatibility table | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write # open PR | ||
contents: write # update version files | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Update versions | ||
id: update_versions | ||
run: | | ||
npm run update:neuron-compatible | ||
git add compatible.json | ||
- name: Set GPG | ||
if: ${{ success() }} | ||
uses: crazy-max/ghaction-import-gpg@v5 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
|
||
- name: Open PR to RC branch | ||
if: ${{ success() }} | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
title: Update Neuron compatibility table | ||
commit-message: 'feat: Update Neuron compatibility table' | ||
body: 'Update Neuron compatibility table for a new release' | ||
committer: Chen Yu <[email protected]> | ||
branch: update-neuron-compatible | ||
base: ${{ github.ref_name }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"fullVersions": [ | ||
"0.111", | ||
"0.110", | ||
"0.109", | ||
"0.108", | ||
"0.107", | ||
"0.106", | ||
"0.105", | ||
"0.104", | ||
"0.103" | ||
], | ||
"lightVersions": [ | ||
"0.3", | ||
"0.2" | ||
], | ||
"compatible": { | ||
"0.111": { | ||
"full": [ | ||
"0.111", | ||
"0.110", | ||
"0.109" | ||
], | ||
"light": [ | ||
"0.3", | ||
"0.2" | ||
] | ||
}, | ||
"0.110": { | ||
"full": [ | ||
"0.111", | ||
"0.110", | ||
"0.109" | ||
], | ||
"light": [ | ||
"0.3", | ||
"0.2" | ||
] | ||
}, | ||
"0.106": { | ||
"full": [ | ||
"0.108", | ||
"0.107", | ||
"0.106", | ||
"0.105" | ||
], | ||
"light": [] | ||
}, | ||
"0.103": { | ||
"full": [ | ||
"0.104", | ||
"0.103" | ||
], | ||
"light": [] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const fs = require('node:fs') | ||
const path = require('node:path') | ||
|
||
const exec = () => { | ||
const compatiblePath = path.resolve(__dirname, '../compatible.json') | ||
const info = require(compatiblePath) | ||
const packagePath = path.resolve(__dirname, '../package.json') | ||
const neuronReleaseVersion = require(packagePath).version | ||
const newNeuronVersion = neuronReleaseVersion.slice(0, neuronReleaseVersion.lastIndexOf('.')) | ||
|
||
const lastNeuronVersion = Object.keys(info.compatible).sort((a, b) => { | ||
const [aMajor, aMinor] = a.split('.')?.map(v => +v) ?? [] | ||
const [bMajor, bMinor] = b.split('.')?.map(v => +v) ?? [] | ||
if (aMajor !== bMajor) return bMajor - aMajor | ||
return bMinor - aMinor | ||
})[0] | ||
|
||
if (newNeuronVersion && lastNeuronVersion !== newNeuronVersion) { | ||
info.compatible[newNeuronVersion] = info.compatible[lastNeuronVersion] | ||
fs.writeFileSync(compatiblePath, `${JSON.stringify(info, null, 2)}\r\n`) | ||
} else { | ||
process.exit(1) | ||
} | ||
} | ||
|
||
exec() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c69258f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packaging for test is done in 6899460103
c69258f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packaging for test is done in 6899460662