Skip to content

Commit 0d9ae4b

Browse files
authored
Merge pull request #24 from chiragmak10/feat-github-linking
fix release versioning
2 parents 588ad21 + e73bd84 commit 0d9ae4b

9 files changed

Lines changed: 1306 additions & 87 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches: [master]
6-
pull_request+:
6+
pull_request:
77
branches: [master]
88

99
jobs:
@@ -24,20 +24,19 @@ jobs:
2424
- name: Install dependencies
2525
run: npm ci
2626

27-
- name: Check Types
28-
run: npm run build
29-
30-
- name: Test Build
31-
run: npm run build
32-
3327

34-
- name: Test Build
35-
run: npm run lint
36-
37-
38-
- name: Test Build
28+
- name: Run tests
3929
run: npm run test
4030

41-
- name: Test Build
31+
- name: Build project
4232
run: npm run build
4333

34+
- name: Run tests with coverage
35+
run: npm run test:coverage
36+
37+
- name: Upload coverage reports
38+
uses: codecov/codecov-action@v4
39+
if: always()
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
fail_ci_if_error: false

.github/workflows/codeql.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CodeQL Security Analysis
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
actions: read
11+
contents: read
12+
security-events: write
13+
14+
jobs:
15+
analyze:
16+
name: Analyze Code
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: ['javascript']
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v3
30+
with:
31+
languages: ${{ matrix.language }}
32+
queries: +security-and-quality
33+
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@v3
36+
37+
- name: Perform CodeQL Analysis
38+
uses: github/codeql-action/analyze@v3
39+
with:
40+
category: "/language:${{ matrix.language }}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Dependency Review
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
dependency-review:
13+
name: Review Dependencies
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Dependency Review
21+
uses: actions/dependency-review-action@v4
22+
with:
23+
# Fail on critical or high severity vulnerabilities
24+
fail-on-severity: moderate
25+
# Deny these copyleft licenses
26+
deny-licenses: GPL-3.0, AGPL-3.0, LGPL-3.0
27+
comment-summary-in-pr: always

.github/workflows/release.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- 'v*.*.*' # Matches v1.0.0, v1.2.3, etc.
7+
- 'v*.*.*-beta.*' # Matches v1.0.0-beta.1, etc.
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
id-token: write
614

715
jobs:
8-
publish:
9-
name: Publish to npm
16+
release:
17+
name: Build and Publish Release
1018
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
13-
id-token: write
1419

1520
steps:
16-
- name: Checkout repository
21+
- name: Checkout
1722
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
1825

1926
- name: Setup Node.js
2027
uses: actions/setup-node@v4
@@ -28,8 +35,32 @@ jobs:
2835
- name: Build
2936
run: npm run build
3037

31-
- name: Publish
32-
run: npm publish
38+
- name: Run tests
39+
run: npm test
40+
41+
- name: Extract version from tag
42+
id: get_version
43+
run: |
44+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
45+
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
46+
47+
- name: Update package.json version
48+
run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version --allow-same-version
49+
50+
- name: Publish to NPM
51+
run: |
52+
if [[ "${{ steps.get_version.outputs.VERSION }}" == *"beta"* ]]; then
53+
npm publish --tag beta
54+
else
55+
npm publish --tag latest
56+
fi
3357
env:
3458
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3559

60+
- name: Create GitHub Release
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
generate_release_notes: true
64+
prerelease: ${{ contains(steps.get_version.outputs.VERSION, 'beta') }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)