Skip to content

Commit

Permalink
chore: update build system (#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Feb 27, 2025
1 parent 9082084 commit 13494b7
Show file tree
Hide file tree
Showing 23 changed files with 3,301 additions and 2,666 deletions.
18 changes: 14 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["babel", "markdown", "sonarjs", "prettier", "@typescript-eslint", "typescript-sort-keys"],
"plugins": ["markdown", "sonarjs", "prettier", "@typescript-eslint", "typescript-sort-keys"],
"extends": ["eslint:recommended", "plugin:sonarjs/recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
Expand All @@ -19,7 +19,6 @@
"no-self-compare": 2,
"prefer-const": 2,
"object-shorthand": 1,
"babel/no-invalid-this": 2,
"array-callback-return": 2,
"valid-typeof": 2,
"react/prop-types": 0,
Expand All @@ -32,9 +31,20 @@
"typescript-sort-keys/interface": [
"error",
"asc",
{ "caseSensitive": false, "natural": true, "requiredFirst": true }
{
"caseSensitive": false,
"natural": true,
"requiredFirst": true
}
],
"typescript-sort-keys/string-enum": ["error", "asc", { "caseSensitive": false, "natural": true }]
"typescript-sort-keys/string-enum": [
"error",
"asc",
{
"caseSensitive": false,
"natural": true
}
]
},
"env": {
"es6": true,
Expand Down
9 changes: 7 additions & 2 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ description: Sets up Node and Build SDK

inputs:
node-version:
description: "Specify Node version"
required: false
default: '16'
default: "22"

runs:
using: 'composite'
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: https://registry.npmjs.org

- name: Set NODE_VERSION env
shell: bash
run: echo "NODE_VERSION=$(node --version)" >> $GITHUB_ENV

- name: Cache Dependencies
uses: actions/cache@v3
with:
Expand Down
68 changes: 0 additions & 68 deletions .github/workflows/initiate_release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: ./.github/actions/setup-node

- name: Commit message lint
- name: Commit Message Lint
run: echo "${{ github.event.pull_request.title }}" | yarn commitlinter

- name: Lint
Expand Down
57 changes: 25 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
name: Release

on:
pull_request:
types: [closed]
branches:
- master
workflow_dispatch:
inputs:
dry_run:
description: Run package release in "dry run" mode (does not publish)
default: false
type: boolean

jobs:
Release:
name: 🚀 Release
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
package_release:
name: Release from "${{ github.ref_name }}" branch
runs-on: ubuntu-latest
# GH does not allow to limit branches in the workflow_dispatch settings so this here is a safety measure
if: ${{ inputs.dry_run || startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'master') }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/github-script@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
script: |
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
core.exportVariable('CHANGELOG', get_change_log_diff())
// Getting the release version from the PR source branch
// Source branch looks like this: release-1.0.0
const version = context.payload.pull_request.head.ref.split('-')[1]
core.exportVariable('VERSION', version)
- uses: ./.github/actions/setup-node

- name: Publish package
run: npm publish
node-version: 22
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create release on GitHub
uses: ncipollo/release-action@v1
with:
body: ${{ env.CHANGELOG }}
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# https://github.com/stream-ci-bot
GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}
HUSKY: 0
run: >
yarn semantic-release
${{ inputs.dry_run && '--dry-run' || '' }}
7 changes: 1 addition & 6 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ concurrency:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 17, 18]
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node }}

- name: Unit tests
- name: Unit Tests with Node ${{ env.NODE_VERSION }}
run: yarn run test-coverage
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://json.schemastore.org/mocharc",
"bail": true,
"exit": true,
"timeout": 20000,
"require": ["ts-node/register"]
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
81 changes: 81 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"branches": [
{
"name": "master",
"channel": "latest"
},
{
"name": "release-v8",
"channel": "v8",
"range": "8.x"
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "type": "chore", "scope": "deps", "release": "patch" },
{ "type": "refactor", "release": "patch" }
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "chore",
"scope": "deps",
"section": "Chores",
"hidden": false
},
{
"type": "refactor",
"section": "Refactors",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements",
"hidden": false
}
]
}
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "NEXT_VERSION=${nextRelease.version} npm run build"
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "./CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": ["./CHANGELOG.md"]
}
],
"@semantic-release/github",
"@semantic-release/npm"
]
}
Loading

0 comments on commit 13494b7

Please sign in to comment.