Skip to content

Commit 6655c6d

Browse files
Copilothotlong
andcommitted
Add GitHub Actions automation workflows (CI, Release, Code Quality)
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent c0ded44 commit 6655c6d

3 files changed

Lines changed: 139 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
build:
11+
name: Build and Type Check
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci --legacy-peer-deps || npm install --legacy-peer-deps
30+
31+
- name: Type check
32+
run: npm run typecheck
33+
34+
- name: Build
35+
run: npm run build
36+
37+
- name: Upload build artifacts
38+
if: matrix.node-version == '20.x'
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: build-artifacts
42+
path: dist/
43+
retention-days: 7

.github/workflows/code-quality.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Code Quality
2+
3+
on:
4+
pull_request:
5+
branches: [main, develop]
6+
7+
jobs:
8+
dependency-review:
9+
name: Dependency Review
10+
runs-on: ubuntu-latest
11+
if: github.event_name == 'pull_request'
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Dependency Review
18+
uses: actions/dependency-review-action@v4
19+
with:
20+
fail-on-severity: moderate
21+
22+
codeql:
23+
name: CodeQL Security Analysis
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
security-events: write
28+
actions: read
29+
contents: read
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v3
37+
with:
38+
languages: typescript, javascript
39+
40+
- name: Autobuild
41+
uses: github/codeql-action/autobuild@v3
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v3

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
name: Build and Release
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
packages: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20.x'
26+
cache: 'npm'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Install dependencies
30+
run: npm ci --legacy-peer-deps || npm install --legacy-peer-deps
31+
32+
- name: Type check
33+
run: npm run typecheck
34+
35+
- name: Build
36+
run: npm run build
37+
38+
- name: Create GitHub Release
39+
uses: softprops/action-gh-release@v1
40+
if: startsWith(github.ref, 'refs/tags/')
41+
with:
42+
draft: false
43+
generate_release_notes: true
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
47+
# Uncomment when ready to publish to npm
48+
# - name: Publish to npm
49+
# if: startsWith(github.ref, 'refs/tags/')
50+
# run: npm publish --access public
51+
# env:
52+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)