Skip to content

Commit 0287c51

Browse files
committed
ci: add GitHub Actions workflows
1 parent ebc56df commit 0287c51

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches: [main]
5+
push:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
checks:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: pnpm/action-setup@v4
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: pnpm
22+
- run: pnpm install --frozen-lockfile
23+
- run: pnpm lint
24+
- run: pnpm typecheck
25+
- run: pnpm test --run

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to npm
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: pnpm/action-setup@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
cache: pnpm
20+
registry-url: "https://registry.npmjs.org"
21+
- run: pnpm install --frozen-lockfile
22+
- run: pnpm lint
23+
- run: pnpm typecheck
24+
- run: pnpm test --run
25+
- run: pnpm build
26+
- run: |
27+
TARBALL=$(ls /tmp/*.tgz)
28+
echo "Package size: $(du -h $TARBALL | cut -f1)"
29+
tar -tzf $TARBALL | head -40
30+
- run: pnpm publish --provenance --access public --no-git-checks
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)