Skip to content

Commit 858cf6a

Browse files
committed
ci: continuous integration and publish
1 parent d06c70f commit 858cf6a

18 files changed

+3844
-193
lines changed

.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module.exports = {
2626
// Fixes eslint not being able to detect react version
2727
react: { pragma: 'React', fragment: 'Fragment', version: 'detect' },
2828
},
29+
env: {
30+
browser: true,
31+
node: true,
32+
},
2933
rules: {
3034
'max-params': ['error', 3],
3135
'prettier/prettier': 'error',
@@ -87,5 +91,11 @@ module.exports = {
8791
'react/no-multi-comp': ['off'],
8892
},
8993
},
94+
{
95+
files: ['**/*.js'],
96+
rules: {
97+
'@typescript-eslint/no-var-requires': ['off'],
98+
},
99+
},
90100
],
91101
};

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Continuous Integration'
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
actions: read
10+
pull-requests: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
verify:
18+
name: Verify
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Collect Workflow Telemetry
25+
uses: catchpoint/workflow-telemetry-action@v2
26+
with:
27+
comment_on_pr: false
28+
29+
- name: Setup node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version-file: '.nvmrc'
33+
cache: 'yarn'
34+
35+
- name: Node modules cache
36+
uses: actions/cache@v4
37+
with:
38+
path: node_modules
39+
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
40+
41+
- name: Install dependencies
42+
run: yarn install --immutable --inline-builds
43+
44+
- name: Format
45+
run: yarn format-check
46+
47+
- name: Lint
48+
run: yarn lint
49+
50+
- name: Typecheck
51+
run: yarn type-check

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 'Publish'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
actions: read
12+
pull-requests: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
publish:
20+
name: Publish
21+
if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release):')
22+
runs-on: ubuntu-20.04
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Collect Workflow Telemetry
28+
uses: catchpoint/workflow-telemetry-action@v2
29+
with:
30+
comment_on_pr: false
31+
32+
- name: Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version-file: '.nvmrc'
36+
cache: 'yarn'
37+
38+
- name: Node modules cache
39+
uses: actions/cache@v4
40+
with:
41+
path: node_modules
42+
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
43+
44+
- name: Install dependencies
45+
run: yarn install --immutable --inline-builds
46+
47+
- name: Format
48+
run: yarn format-check
49+
50+
- name: Lint
51+
run: yarn lint
52+
53+
- name: Typecheck
54+
run: yarn type-check
55+
56+
- name: Build
57+
run: yarn build
58+
59+
- name: Release npm package
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
NPM_TOKEN: ${{ secrets.GH_TOKEN }}
63+
run: npx semantic-release

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged -c ./lint-staged.config.js

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.12.2

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
node_modules
33
.yarn
44
src/icons/**
5+
CHANGELOG.md

.releaserc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/changelog",
9+
"@semantic-release/npm",
10+
[
11+
"@semantic-release/github",
12+
{
13+
"successComment": false,
14+
"failComment": false,
15+
"labels": false
16+
}
17+
],
18+
[
19+
"@semantic-release/git",
20+
{
21+
"assets": [
22+
"package.json",
23+
"CHANGELOG.md"
24+
],
25+
"message": "chore(release): ${nextRelease.version}"
26+
}
27+
]
28+
]
29+
}

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

lint-staged.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
// Type check TypeScript files
3+
'**/*.(ts|tsx)': () => 'yarn type-check',
4+
5+
// Lint then format TypeScript and JavaScript files
6+
'**/*.(ts|tsx|js)': filenames => [
7+
`yarn lint:fix ${filenames.join(' ')}`,
8+
`yarn format ${filenames.join(' ')}`,
9+
],
10+
11+
// Format MarkDown and JSON
12+
'**/*.(md|json)': filenames => `yarn format ${filenames.join(' ')}`,
13+
};

0 commit comments

Comments
 (0)