Skip to content

Commit caced37

Browse files
committed
chore: better tooling, CI
1 parent cf5b8e2 commit caced37

File tree

9 files changed

+371
-55
lines changed

9 files changed

+371
-55
lines changed

.github/COMMIT_CONVENTION.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Commit Convention Guide
2+
3+
This project uses **Conventional Commits** to automatically generate changelogs and releases.
4+
5+
## Format
6+
7+
```
8+
<type>[optional scope]: <description>
9+
10+
[optional body]
11+
12+
[optional footer(s)]
13+
```
14+
15+
## Types
16+
17+
| Type | Description | Changelog Section |
18+
|------|-------------|-------------------|
19+
| `feat` | New features | 🚀 Features |
20+
| `fix` | Bug fixes | 🐛 Bug Fixes |
21+
| `docs` | Documentation changes | 📚 Documentation |
22+
| `style` | Code style changes (formatting, etc.) | 🔧 Maintenance |
23+
| `refactor` | Code refactoring | 🔧 Maintenance |
24+
| `test` | Adding or updating tests | 🔧 Maintenance |
25+
| `chore` | Build process, tooling, dependencies | 🔧 Maintenance |
26+
| `ci` | CI/CD changes | 🔧 Maintenance |
27+
28+
## Breaking Changes
29+
30+
Add `!` after the type to indicate breaking changes:
31+
```
32+
feat!: remove deprecated notification API
33+
```
34+
35+
## Examples
36+
37+
### Features
38+
```
39+
feat: add notification rate limiting
40+
feat(ui): add custom color theme picker
41+
feat(settings): implement notification positioning controls
42+
```
43+
44+
### Bug Fixes
45+
```
46+
fix: resolve memory leak in notification cleanup
47+
fix(themes): correct color inheritance for dark mode
48+
fix(positioning): fix notifications overlapping on dual monitors
49+
```
50+
51+
### Documentation
52+
```
53+
docs: update installation instructions
54+
docs(api): add JSDoc comments for notification utils
55+
```
56+
57+
### Maintenance
58+
```
59+
chore: update dependencies to latest versions
60+
refactor: simplify notification filtering logic
61+
test: add unit tests for theme utilities
62+
ci: add automated testing workflow
63+
```
64+
65+
### Breaking Changes
66+
```
67+
feat!: change notification API to use async/await
68+
fix!: remove support for GNOME Shell 45
69+
```
70+
71+
## Scopes (Optional)
72+
73+
Use scopes to specify what part of the codebase is affected:
74+
75+
- `ui` - User interface changes
76+
- `settings` - Settings/preferences related
77+
- `themes` - Color themes and styling
78+
- `notifications` - Core notification logic
79+
- `positioning` - Notification positioning
80+
- `filtering` - Notification filtering
81+
- `api` - API changes
82+
- `deps` - Dependencies
83+
84+
## Benefits
85+
86+
**Automatic Changelog** - Commits are automatically categorized and formatted
87+
**Clear History** - Easy to understand what each commit does
88+
**Automated Releases** - Semantic versioning based on commit types
89+
**Better Collaboration** - Consistent commit messages across contributors
90+
91+
## Tools
92+
93+
- **Commitizen**: `npm install -g commitizen cz-conventional-changelog`
94+
- **Conventional Changelog**: Automatically generates CHANGELOG.md
95+
- **Semantic Release**: Automates version bumping and releases
96+
97+
## Quick Reference
98+
99+
```bash
100+
# Features
101+
git commit -m "feat: add new notification sound options"
102+
103+
# Bug fixes
104+
git commit -m "fix: resolve notification positioning on ultrawide monitors"
105+
106+
# Breaking changes
107+
git commit -m "feat!: migrate to new GNOME Shell extension API"
108+
109+
# With scope
110+
git commit -m "feat(themes): add high contrast theme support"
111+
```
112+
113+
Remember: The first line should be **under 72 characters** and use **imperative mood** (e.g., "add" not "added").

.github/changelog-config.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## 🚀 Features",
5+
"rules": [{ "pattern": "^feat(\\(.+\\))?: .+$", "on_property": "title" }]
6+
},
7+
{
8+
"title": "## 🐛 Bug Fixes",
9+
"rules": [{ "pattern": "^fix(\\(.+\\))?: .+$", "on_property": "title" }]
10+
},
11+
{
12+
"title": "## ⚠️ Breaking Changes",
13+
"rules": [{ "pattern": "^.*!: .+$", "on_property": "title" }]
14+
},
15+
{
16+
"title": "## ✅ Tests",
17+
"rules": [{ "pattern": "^test(\\(.+\\))?: .+$", "on_property": "title" }]
18+
},
19+
{
20+
"title": "## 🚧 Maintenance",
21+
"rules": [
22+
{ "pattern": "^(refactor|style): .+$", "on_property": "title" },
23+
{ "pattern": "^chore(\\(.+\\))?: .+$", "on_property": "title" },
24+
{ "pattern": "^ci(\\(.+\\))?: .+$", "on_property": "title" }
25+
]
26+
}
27+
],
28+
"sort": {
29+
"order": "ASC",
30+
"on_property": "mergedAt"
31+
},
32+
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
33+
"commit_template": "- #{{TITLE}}"
34+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build and Package
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20'
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Install system dependencies
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y glib2.0-dev libglib2.0-dev-bin gettext
38+
39+
- name: Build extension
40+
run: npm run build
41+
42+
- name: Cleanup build
43+
run: npm run cleanup
44+
45+
- name: Package extension
46+
run: npm run pack
47+
48+
- name: Get package version
49+
id: package_version
50+
run: echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
51+
52+
- name: Check if tag exists
53+
id: tag_exists
54+
run: |
55+
if git rev-parse "${{ steps.package_version.outputs.version }}" >/dev/null 2>&1; then
56+
echo "exists=true" >> $GITHUB_OUTPUT
57+
else
58+
echo "exists=false" >> $GITHUB_OUTPUT
59+
fi
60+
61+
- name: Get previous tag
62+
if: github.ref == 'refs/heads/main'
63+
id: previous_tag
64+
run: |
65+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
66+
echo "from_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
67+
68+
- name: Create tag
69+
if: github.ref == 'refs/heads/main' && steps.tag_exists.outputs.exists == 'false'
70+
run: |
71+
git config user.name "github-actions[bot]"
72+
git config user.email "github-actions[bot]@users.noreply.github.com"
73+
git tag ${{ steps.package_version.outputs.version }}
74+
git push origin ${{ steps.package_version.outputs.version }}
75+
76+
- name: Generate changelog
77+
if: github.ref == 'refs/heads/main' && steps.tag_exists.outputs.exists == 'false'
78+
id: changelog
79+
uses: mikepenz/release-changelog-builder-action@v5
80+
with:
81+
mode: "HYBRID"
82+
configuration: ".github/changelog-config.json"
83+
outputFile: "CHANGELOG.md"
84+
fromTag: ${{ steps.previous_tag.outputs.from_tag }}
85+
toTag: ${{ steps.package_version.outputs.version }}
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
89+
90+
91+
- name: Upload package artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: gnome-shell-extension-package
95+
96+
retention-days: 30
97+
98+
- name: Create release
99+
if: github.ref == 'refs/heads/main' && steps.tag_exists.outputs.exists == 'false'
100+
uses: softprops/action-gh-release@v1
101+
with:
102+
tag_name: ${{ steps.package_version.outputs.version }}
103+
name: Release ${{ steps.package_version.outputs.version }}
104+
body: ${{ steps.changelog.outputs.changelog }}
105+
files: |
106+
107+
CHANGELOG.md
108+
draft: false
109+
prerelease: false
110+
generate_release_notes: false
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cli

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

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
"version": "1.0.0",
55
"keywords": [],
66
"scripts": {
7-
"start": "./cli dev",
8-
"clean": "./cli clean",
9-
"build": "./cli build",
10-
"pack": "./cli pack"
7+
"start": "./scripts/cli dev",
8+
"clean": "./scripts/cli clean",
9+
"build": "./scripts/cli build",
10+
"cleanup": "./scripts/cli cleanup",
11+
"inject": "./scripts/cli inject",
12+
"pack": "./scripts/cli pack",
13+
"translate": "./scripts/cli translate",
14+
"format": "biome format src --write; biome lint src --write "
1115
},
1216
"author": "ExposedCat",
1317
"license": "LGPL-3.0-or-later",
@@ -30,4 +34,4 @@
3034
},
3135
"homepage": "https://github.com/ExposedCat/gnome-focus-mode#readme",
3236
"sideEffects": false
33-
}
37+
}

0 commit comments

Comments
 (0)