Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit 29d0817

Browse files
committed
ci: setup ci/cd
1 parent d197b6b commit 29d0817

File tree

3 files changed

+92
-2
lines changed

3 files changed

+92
-2
lines changed

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish-packages:
10+
name: Publish packages to NPM
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
ref: main
17+
fetch-depth: '0'
18+
token: ${{ secrets.GH_TOKEN }}
19+
20+
- name: Set node version
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 20
24+
25+
- name: Cache dependencies
26+
id: cache
27+
uses: actions/cache@v3
28+
with:
29+
path: '**/node_modules'
30+
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
33+
${{ runner.os }}-node-
34+
35+
- name: Install dependencies
36+
if: steps.cache.outputs.cache-hit != 'true'
37+
run: yarn install --immutable
38+
39+
- name: Check
40+
run: yarn t
41+
42+
- name: Build
43+
run: yarn build
44+
45+
- name: Semantic Release
46+
uses: cycjimmy/semantic-release-action@v4
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
49+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
50+
with:
51+
branches: 'main'

.github/workflows/static-check.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Static Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- main
8+
9+
jobs:
10+
check:
11+
name: Static Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: '0'
18+
19+
- name: Set node version
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 20
23+
24+
- name: Cache dependencies
25+
id: cache
26+
uses: actions/cache@v3
27+
with:
28+
path: '**/node_modules'
29+
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
32+
${{ runner.os }}-node-
33+
34+
- name: Install dependencies
35+
if: steps.cache.outputs.cache-hit != 'true'
36+
run: yarn install --immutable
37+
38+
- name: Check
39+
run: yarn t

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
},
99
"homepage": "https://github.com/mj-studio-library/react-design-toolkit",
1010
"scripts": {
11-
"t": "eslint src && yarn tsc",
12-
"build": "yarn t && rm -rf dist && rm -rf esm && rollup --config rollup.config.mjs",
11+
"t": "eslint src --ext .ts,.tsx,.js,.jsx && yarn tsc",
12+
"build": "rm -rf dist && rm -rf esm && rollup --config rollup.config.mjs",
1313
"release": "yarn t && zx tool/publish.mjs",
1414
"icon": "zx tool/svg_gen.mjs",
1515
"prepare": "husky"

0 commit comments

Comments
 (0)