Skip to content

Commit 58628b1

Browse files
committed
Added changeset release action
1 parent ae7447c commit 58628b1

File tree

3 files changed

+58
-7
lines changed

3 files changed

+58
-7
lines changed

.github/workflows/ci.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ on: [push]
44

55
jobs:
66
ci:
7+
name: CI
78
runs-on: ubuntu-latest
89
steps:
9-
- uses: actions/checkout@v3
10-
- uses: actions/setup-node@v3
11-
with:
12-
node-version: 18
13-
cache: 'npm'
14-
- run: npm ci
15-
- run: npm run lint
10+
- name: Checkout Repo
11+
uses: actions/checkout@v3
12+
13+
- name: Setup Node.js 18
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 18
17+
cache: 'npm'
18+
19+
- name: Install Dependencies
20+
run: npm ci
21+
22+
- name: Run lint
23+
run: npm run lint

.github/workflows/release.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js 18
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
cache: 'npm'
23+
24+
- name: Install Dependencies
25+
run: npm ci
26+
27+
- name: Run lint
28+
run: npm run lint
29+
30+
- name: Create Release Pull Request
31+
uses: changesets/action@v1
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Create Release Pull Request or Publish to npm
36+
id: changesets
37+
uses: changesets/action@v1
38+
with:
39+
publish: npm run release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"eslint": "^8.35.0"
99
},
1010
"scripts": {
11+
"release": "changeset version && changeset publish",
1112
"changeset": "changeset add",
1213
"lint": "eslint './**/*.{js,ts,jsx,tsx,cjs,mjs}'"
1314
},

0 commit comments

Comments
 (0)