Skip to content

Commit 2805ce6

Browse files
committed
ci: add GitHub CI and release workflows
1 parent 2f7e73d commit 2805ce6

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# GitHub CI Workflow
2+
name: CI
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- dev
10+
pull_request:
11+
branches:
12+
- main
13+
14+
jobs:
15+
test-and-build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- run: corepack enable
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "20"
27+
cache: "yarn"
28+
29+
- name: Install dependencies
30+
run: yarn install --immutable
31+
32+
- name: Setup environment
33+
run: |
34+
echo "NODE_ENV=test" >> $GITHUB_ENV
35+
# Add any other environment variables here
36+
37+
- name: Run tests with coverage
38+
run: yarn test:coverage:ci
39+
40+
- name: Build
41+
run: yarn build
42+
43+
- name: Upload coverage reports
44+
uses: codecov/codecov-action@v5
45+
with:
46+
directory: ./coverage/
47+
fail_ci_if_error: false
48+
49+
- name: Upload build artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: dist
53+
path: dist/
54+
retention-days: 7

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- run: corepack enable
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
cache: "yarn"
23+
registry-url: "https://registry.npmjs.org"
24+
25+
- name: Install dependencies
26+
run: yarn install --immutable
27+
28+
- name: Build
29+
run: yarn build
30+
31+
- name: Run tests
32+
run: yarn test
33+
34+
- name: Create GitHub Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
generate_release_notes: true
38+
files: |
39+
dist/**/*
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
# Uncomment to publish to npm
44+
# - name: Publish to npm
45+
# run: npm publish
46+
# env:
47+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)