Skip to content

Commit 5878dd1

Browse files
committed
feat(release): implement conventional commits approach
- Add commitlint to enforce conventional commit format - Replace changesets with semantic-release - Set up GitHub Actions workflow for automated releases - Update documentation with new release process - Add commit message template Closes #140
1 parent a018feb commit 5878dd1

File tree

14 files changed

+2391
-75
lines changed

14 files changed

+2391
-75
lines changed

.changeset/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/config.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

.changeset/itchy-hounds-cross.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/new-nails-search.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
packages: write
13+
14+
env:
15+
pnpm-version: 10.2.1
16+
node-version: 23
17+
18+
jobs:
19+
release:
20+
name: Release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Setup pnpm
30+
uses: pnpm/action-setup@v2
31+
with:
32+
version: ${{ env.pnpm-version }}
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ env.node-version }}
38+
cache: 'pnpm'
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Build
44+
run: pnpm build
45+
46+
- name: Install browsers
47+
run: cd packages/agent && pnpm exec playwright install --with-deps chromium
48+
49+
- name: Test
50+
run: pnpm test
51+
52+
- name: Release
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
run: pnpm semantic-release

.gitmessage

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# <type>(<scope>): <subject>
2+
# |<---- Using a maximum of 50 characters ---->|
3+
4+
# Explain why this change is being made
5+
# |<---- Try to limit each line to a maximum of 72 characters ---->|
6+
7+
# Provide links or keys to any relevant tickets, articles or other resources
8+
# Example: Github issue #23
9+
10+
# --- COMMIT END ---
11+
# Type can be
12+
# feat (new feature)
13+
# fix (bug fix)
14+
# docs (changes to documentation)
15+
# style (formatting, missing semi colons, etc; no code change)
16+
# refactor (refactoring production code)
17+
# test (adding missing tests, refactoring tests; no production code change)
18+
# chore (updating grunt tasks etc; no production code change)
19+
# --------------------
20+
# Remember to
21+
# - Capitalize the subject line
22+
# - Use the imperative mood in the subject line
23+
# - Do not end the subject line with a period
24+
# - Separate subject from body with a blank line
25+
# - Use the body to explain what and why vs. how
26+
# - Can use multiple lines with "-" for bullet points in body
27+
# --------------------

.husky/commit-msg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Validate commit message with commitlint
5+
npx --no -- commitlint --edit $1

.releaserc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"@semantic-release/changelog",
7+
"@semantic-release/npm",
8+
["@semantic-release/git", {
9+
"assets": ["package.json", "CHANGELOG.md"],
10+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
11+
}],
12+
"@semantic-release/github"
13+
]
14+
}

CONTRIBUTING.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,41 @@ This project and everyone participating in it is governed by our Code of Conduct
7272
4. Commit your changes:
7373

7474
```bash
75-
git commit -m "feat: add your feature description"
75+
git commit
7676
```
7777

78-
Follow [Conventional Commits](https://www.conventionalcommits.org/) specification.
78+
We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for our commit messages:
79+
80+
- **feat**: A new feature
81+
- **fix**: A bug fix
82+
- **docs**: Documentation only changes
83+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, etc)
84+
- **refactor**: A code change that neither fixes a bug nor adds a feature
85+
- **perf**: A code change that improves performance
86+
- **test**: Adding missing tests or correcting existing tests
87+
- **chore**: Changes to the build process or auxiliary tools and libraries
88+
89+
Each commit message should be structured as follows:
90+
```
91+
<type>[optional scope]: <description>
92+
93+
[optional body]
94+
95+
[optional footer(s)]
96+
```
97+
98+
Example:
99+
```
100+
feat(auth): implement JWT authentication
101+
102+
- Add JWT token generation
103+
- Add token validation middleware
104+
- Update user routes to use authentication
105+
106+
Closes #123
107+
```
108+
109+
We have set up a commit message template and commitlint to help you follow this convention.
79110

80111
5. Push to your fork and create a Pull Request
81112

@@ -161,9 +192,18 @@ This project and everyone participating in it is governed by our Code of Conduct
161192

162193
## Release Process
163194

164-
1. Maintainers will handle releases
165-
2. Follow semantic versioning
166-
3. Update changelog entries
167-
4. Tag releases appropriately
195+
1. Releases are automated through our CI/CD pipeline
196+
2. When code is merged to the main branch, semantic-release:
197+
- Determines the next version based on conventional commit messages
198+
- Generates a changelog from commit messages
199+
- Creates a GitHub Release with the changelog
200+
- Tags the release
201+
- Publishes to NPM
202+
3. No manual release steps are required
203+
4. Ensure your commit messages follow the conventional commits format to trigger appropriate version bumps:
204+
- `feat:` commits trigger a minor version bump
205+
- `fix:` commits trigger a patch version bump
206+
- `perf:` commits trigger a patch version bump
207+
- Commits with `BREAKING CHANGE:` in the footer trigger a major version bump
168208

169209
Thank you for contributing to MyCoder! 👍

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ pnpm build
3838
pnpm test
3939
```
4040

41+
## Release Process
42+
43+
MyCoder follows the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. Our release process is fully automated:
44+
45+
1. Commit your changes following the conventional commits format
46+
2. Create a PR and get it reviewed and approved
47+
3. When merged to main, our CI/CD pipeline will:
48+
- Determine the next version based on commit messages
49+
- Generate a changelog
50+
- Create a GitHub Release
51+
- Tag the release
52+
- Publish to NPM
53+
54+
For more details, see the [Contributing Guide](CONTRIBUTING.md).
55+
4156
## Contributing
4257

4358
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

0 commit comments

Comments
 (0)