Skip to content

Commit 235c25c

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

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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@v3
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: "20"
25+
cache: "yarn"
26+
27+
- name: Install dependencies
28+
run: yarn install --immutable
29+
30+
- name: Setup environment
31+
run: |
32+
echo "NODE_ENV=test" >> $GITHUB_ENV
33+
# Add any other environment variables here
34+
35+
- name: Run tests with coverage
36+
run: yarn test:coverage:ci
37+
38+
- name: Build
39+
run: yarn build
40+
41+
- name: Upload coverage reports
42+
uses: codecov/codecov-action@v3
43+
with:
44+
directory: ./coverage/
45+
fail_ci_if_error: false
46+
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: dist
51+
path: dist/
52+
retention-days: 7

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)