Skip to content

Commit da4ea7b

Browse files
authored
ci: add workflows (#3)
1 parent 97f19f9 commit da4ea7b

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
node-version: [18, 20, 22]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
25+
- name: Set node version to ${{ matrix.node-version }}
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
30+
- name: Install & Build
31+
run: |
32+
pnpm install
33+
pnpm build
34+
35+
- name: Typecheck
36+
run: pnpm typecheck
37+
38+
- name: Test
39+
run: pnpm test

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-type:
7+
type: choice
8+
description: Type of the release
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v2
27+
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: "20"
31+
registry-url: "https://registry.npmjs.org"
32+
33+
- name: Install & Build
34+
run: |
35+
pnpm install
36+
pnpm build
37+
38+
- name: Typecheck
39+
run: pnpm typecheck
40+
41+
- name: Test
42+
run: pnpm test
43+
44+
- name: Configure github-actions git
45+
run: |
46+
git config --global user.name 'github-actions'
47+
git config --global user.email '[email protected]'
48+
49+
- name: Bump version
50+
run: pnpm version ${{ github.event.inputs.release-type }}
51+
52+
- name: Push release tag
53+
run: git push origin main --follow-tags
54+
55+
- name: Publish to npm
56+
run: pnpm publish --provenance
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)