Skip to content

Commit df549d9

Browse files
committed
chore(workflows): add ci and release action
1 parent f6365e8 commit df549d9

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v2
23+
with:
24+
version: 10
25+
26+
- name: Set node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: lts/*
30+
cache: 'pnpm'
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Build
36+
run: pnpm build
37+
38+
- name: Lint
39+
run: pnpm lint:fix
40+
41+
test:
42+
runs-on: ${{ matrix.os }}
43+
44+
strategy:
45+
matrix:
46+
node: [lts/*]
47+
os: [ubuntu-latest, windows-latest, macos-latest]
48+
fail-fast: false
49+
50+
steps:
51+
- uses: actions/checkout@v3
52+
53+
- name: Install pnpm
54+
uses: pnpm/action-setup@v2
55+
56+
- name: Set node ${{ matrix.node }}
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: ${{ matrix.node }}
60+
cache: 'pnpm'
61+
62+
- name: Install dependencies
63+
run: pnpm install --frozen-lockfile
64+
65+
- name: Build
66+
run: pnpm build:package

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v2
19+
with:
20+
version: 10
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: lts/*
26+
cache: 'pnpm'
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Build package
32+
run: pnpm build
33+
34+
- name: Generate changelog
35+
run: pnpx changelogithub
36+
continue-on-error: true
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Setup npm authentication
41+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
42+
env:
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
45+
- name: Publish to npm
46+
run: pnpm publish --access public --no-git-checks
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)