Skip to content

Commit

Permalink
chore: bump node v 20 and add semantic release [OTE-804] (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam authored Sep 17, 2024
1 parent f0ed2f2 commit 20e524e
Show file tree
Hide file tree
Showing 9 changed files with 11,027 additions and 4,840 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "[v4-client-js] Conventional PR Title"
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
conventional-pr-title:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./v4-client-js
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js 20.8.1
uses: actions/setup-node@v3
with:
node-version: 20.8.1
registry-url: https://registry.npmjs.org
cache: "npm"
cache-dependency-path: '**/package-lock.json'

- name: Install dependencies
run: |
npm install @commitlint/config-conventional
- name: Lint PR Title
run: |
echo "${PR_TITLE}" | npx commitlint --config commitlint.config.js
env:
PR_TITLE: '${{ github.event.pull_request.title }}'

4 changes: 2 additions & 2 deletions .github/workflows/js-lint-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v3

- name: Use Node.js 16
- name: Use Node.js 20.8.1
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.8.1
registry-url: https://registry.npmjs.org
cache: "npm"
cache-dependency-path: '**/package-lock.json'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/js-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Npm
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20.8.1
registry-url: https://registry.npmjs.org
cache: "npm"
cache-dependency-path: '**/package-lock.json'
Expand All @@ -38,7 +38,10 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_READ }}

- name: Publish
run: ./scripts/publish-if-not-exists.sh
# Run semantic-release to automatically bump the version based on PR title
- name: Run semantic-release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_WRITE }}

31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,34 @@ The original client can be found [here](https://github.com/asnefedovv/dydx-v4-cl
# Third-party Clients

By clicking the above links to third-party clients, you will leave the dYdX Trading Inc. (“dYdX”) GitHub repository and join repositories made available by third parties, which are independent from and unaffiliated with dYdX. dYdX is not responsible for any action taken or content on third-party repositories.

# Contributing

## We use [Conventional Commits](https://github.com/conventional-changelog/commitlint)
We use a commit-msg hook to check if your commit messages meet the conventional commit format.

In general the pattern looks like this:

`type(scope?): subject` #scope is optional; multiple scopes are supported (current delimiter options: "/", "\" and ",")

### Real world examples can look like this:
`chore: run tests on travis ci`
`fix(server): send cors headers`
`feat(blog): add comment section`

Common types according to commitlint-config-conventional can be:

build
chore
ci
docs
feat
fix
perf
refactor
revert
style
test

## Any contributions you make will be under the same License
When you submit code changes, your submissions are understood to be under the same [License](https://github.com/dydxprotocol/v4-web/blob/master/LICENSE) that covers the project.
2 changes: 1 addition & 1 deletion v4-client-js/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20.8.1
11 changes: 11 additions & 0 deletions v4-client-js/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"branches": ["main"],
"tagFormat": "v4-client-js@${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
}
8 changes: 8 additions & 0 deletions v4-client-js/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [0, 'never'],
'header-max-length': [2, 'always', 120],
'body-max-line-length': [0, 'always', 120],
},
};
Loading

0 comments on commit 20e524e

Please sign in to comment.