Skip to content

Commit 5b79d4b

Browse files
committed
add ci
1 parent c029265 commit 5b79d4b

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
- '**/*.org'
10+
pull_request:
11+
paths-ignore:
12+
- '**/*.md'
13+
- '**/*.org'
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: pnpm/action-setup@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: lts/*
24+
cache: pnpm
25+
cache-dependency-path: pnpm-lock.yaml
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
28+
- name: Lint and format check
29+
run: pnpm run check
30+
- name: Build example
31+
run: pnpm run example:build

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CI: true
10+
11+
permissions: {}
12+
13+
jobs:
14+
publish:
15+
name: Publish
16+
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write
19+
contents: read
20+
steps:
21+
- name: Checkout Repo
22+
uses: actions/checkout@v4
23+
24+
- uses: pnpm/action-setup@v4
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
cache: pnpm
29+
cache-dependency-path: pnpm-lock.yaml
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Lint and format check
36+
run: pnpm run check
37+
38+
- name: Build example
39+
run: pnpm run example:build
40+
41+
- name: Verify tag matches package version
42+
run: |
43+
VERSION=$(node -p "require('./package.json').version")
44+
TAG="${GITHUB_REF_NAME#v}"
45+
if [ "$VERSION" != "$TAG" ]; then
46+
echo "Tag version ($TAG) does not match package.json version ($VERSION)"
47+
exit 1
48+
fi
49+
50+
- name: Publish to npm
51+
run: npm publish --access public --provenance

0 commit comments

Comments
 (0)