Skip to content

Commit 8af5595

Browse files
committed
feat(ci): configure automated releases with semantic-release
1 parent 92ad4f0 commit 8af5595

File tree

6 files changed

+10229
-3558
lines changed

6 files changed

+10229
-3558
lines changed

.clinerules

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Cline Custom Instructions
22

3-
- Always refer to the `README.md` for the latest information on the project.
4-
- Always refer to `ARCHITECTURE.md` for the latest information on the architecture of the project.
5-
- Follow programming principles such as DRY, KISS, YAGNI, and SOLID
6-
- Always use the latest version of the programming language and libraries.
7-
- Always prefer the simplest solution.
3+
- ALWAYS refer to the `README.md` for the latest information on the project.
4+
- ALWAYS refer to `ARCHITECTURE.md` for the latest information on the architecture of the project.
5+
- ALWAYS Follow programming principles such as DRY, KISS, YAGNI, and SOLID
6+
- ALWAYS use the latest version of the programming language and libraries.
7+
- ALWAYS prefer the simplest solution.
88
- When importing a relative path, avoid using file extensions like ".js" and ".ts".
9-
- Always add and update TSDoc for all classes, methods and functions. Focus on functionality and reasoning. Avoid documenting individual parameters or return values if their use can easily be derived from their name.
10-
- Always format Git commit messages as markdown
9+
- ALWAYS add and update TSDoc for all classes, methods and functions. Focus on functionality and reasoning. Avoid documenting individual parameters or return values if their use can easily be derived from their name.
10+
- ALWAYS format Git commit messages as markdown.
11+
- ALWAYS adhere to the Conventional Commits specification for all Git commit messages
1112

1213
## Architecture Documentation Guidelines
1314

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '>=20.0.0' # Match engines requirement in package.json
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run linter
27+
run: npm run lint
28+
29+
test:
30+
name: Test
31+
runs-on: ubuntu-latest
32+
needs: lint # Run after linting passes
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '>=20.0.0'
41+
cache: 'npm'
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Run tests
47+
run: npm run test
48+
49+
build:
50+
name: Build
51+
runs-on: ubuntu-latest
52+
needs: test # Run after tests pass
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Set up Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '>=20.0.0'
61+
cache: 'npm'
62+
63+
- name: Install dependencies
64+
run: npm ci
65+
66+
- name: Run build
67+
run: npm run build

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger on pushes to the main branch
7+
8+
jobs:
9+
release:
10+
name: Release to npm and GitHub
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write # Needed to push commits/tags back to the repo
14+
issues: write # Needed to comment on issues/PRs
15+
pull-requests: write # Needed to comment on issues/PRs
16+
# id-token: write # Needed for OIDC trusted publishing (if not using NPM_TOKEN)
17+
steps:
18+
- name: Checkout code
19+
# Need fetch-depth: 0 for semantic-release to analyze all relevant commits
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '>=20.0.0' # Match engines requirement in package.json
28+
registry-url: 'https://registry.npmjs.org' # Specify npm registry
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Run build
35+
run: npm run build
36+
37+
- name: Run semantic-release
38+
run: npx semantic-release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by Actions automatically
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Use a secret stored in GitHub repository settings

.releaserc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/changelog",
8+
{
9+
"changelogFile": "CHANGELOG.md"
10+
}
11+
],
12+
[
13+
"@semantic-release/npm",
14+
{
15+
"npmPublish": true,
16+
"pkgRoot": "."
17+
}
18+
],
19+
[
20+
"@semantic-release/git",
21+
{
22+
"assets": ["package.json", "CHANGELOG.md"],
23+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
24+
}
25+
],
26+
[
27+
"@semantic-release/github",
28+
{
29+
"assets": []
30+
}
31+
]
32+
]
33+
}

0 commit comments

Comments
 (0)