Skip to content

Commit c4d3f16

Browse files
committed
feat: automatic semantic version bumps on release
1 parent e37d4e9 commit c4d3f16

4 files changed

Lines changed: 222 additions & 50 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
pull_request: # Run on pull requests
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '21'
20+
distribution: 'temurin'
21+
22+
- name: Set up Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Run tests
26+
run: ./gradlew test
27+
28+
- name: Build extension
29+
run: ./gradlew bwextension
30+
31+
- name: Upload extension artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: WigAI.bwextension-pr-${{ github.event.number || github.sha }}
35+
path: build/extensions/WigAI.bwextension
36+
retention-days: 7

.github/workflows/release.yml

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
name: Release Extension
22

33
on:
4-
workflow_dispatch: # Allows manual triggering
5-
pull_request: # Run on pull requests
6-
# push:
7-
# branches:
8-
# - main # Triggers on pushes to the main branch
4+
push:
5+
branches: [main] # Automatic releases on main branch
6+
workflow_dispatch: # Manual triggering
97

108
permissions:
119
contents: write
10+
issues: write
11+
pull-requests: write
1212

1313
jobs:
14-
build:
14+
release:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Fetch full history for semantic-release
21+
token: ${{ secrets.GITHUB_TOKEN }}
1922

2023
- name: Set up JDK 21
2124
uses: actions/setup-java@v4
@@ -26,57 +29,47 @@ jobs:
2629
- name: Set up Gradle
2730
uses: gradle/actions/setup-gradle@v4
2831

29-
- name: Build extension
30-
run: ./gradlew bwextension
31-
32-
- name: Upload extension artifact
33-
uses: actions/upload-artifact@v4
34-
with:
35-
name: WigAI.bwextension
36-
path: build/extensions/WigAI.bwextension
37-
38-
release:
39-
runs-on: ubuntu-latest
40-
needs: build
41-
if: github.event_name == 'workflow_dispatch'
42-
# || (github.event_name == 'push' && github.ref == 'refs/heads/main')
43-
steps:
44-
- name: Checkout code
45-
uses: actions/checkout@v4
46-
with:
47-
fetch-depth: 0 # Fetch all history for changelog generation
48-
49-
- name: Download extension artifact
50-
uses: actions/download-artifact@v4
51-
with:
52-
name: WigAI.bwextension
53-
path: . # Download directly into the current workspace directory
54-
55-
- name: Set up Node.js
32+
- name: Setup Node.js
5633
uses: actions/setup-node@v4
5734
with:
5835
node-version: 'lts/*'
5936

60-
- name: Install conventional-changelog-cli
61-
run: npm install -g conventional-changelog-cli conventional-commits-parser
37+
- name: Install semantic-release
38+
run: |
39+
npm install -g semantic-release
40+
npm install -g @semantic-release/changelog
41+
npm install -g @semantic-release/git
42+
npm install -g @semantic-release/github
43+
npm install -g @semantic-release/exec
44+
45+
- name: Run tests
46+
run: ./gradlew test
6247

63-
- name: Generate release notes
64-
run: conventional-changelog -p angular -i CHANGELOG.md -s -r 0 > RELEASE_NOTES.md && cat RELEASE_NOTES.md
48+
- name: Run semantic-release
49+
run: semantic-release
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6552

66-
- name: Get project version
67-
id: get_version
68-
run: echo "PROJECT_VERSION=$(./gradlew -q printVersion)" >> $GITHUB_ENV
53+
- name: Build extension (if version was bumped)
54+
if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true'
55+
run: ./gradlew bwextension
6956

70-
- name: Generate tag name
71-
id: generate_tag # id is not strictly needed here as we are using GITHUB_ENV but good practice
72-
run: echo "TAG_NAME=release-${{ env.PROJECT_VERSION }}-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
57+
- name: Get release info for asset upload
58+
if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true'
59+
id: release_info
60+
run: |
61+
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
62+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ env.SEMANTIC_RELEASE_VERSION }}" \
63+
| jq -r '.id')
64+
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
7365
74-
- name: Create GitHub Release
75-
uses: softprops/action-gh-release@v1
76-
with:
77-
tag_name: ${{ env.TAG_NAME }}
78-
name: Release ${{ env.TAG_NAME }}
79-
body_path: RELEASE_NOTES.md
80-
files: WigAI.bwextension # Updated path
66+
- name: Upload extension to release
67+
if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true'
68+
uses: actions/upload-release-asset@v1
8169
env:
8270
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.release_id }}/assets{?name,label}
73+
asset_path: build/extensions/WigAI.bwextension
74+
asset_name: WigAI.bwextension
75+
asset_content_type: application/java-archive

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.2.0] - 2025-02-06
11+
12+
### Added
13+
- Initial WigAI extension for Bitwig Studio
14+
- MCP (Model Context Protocol) server integration
15+
- Device parameter control tools
16+
- Transport control functionality
17+
- Clip and scene management tools
18+
- Status monitoring capabilities
19+
20+
### Features
21+
- Real-time parameter manipulation through MCP tools
22+
- RESTful API for external control
23+
- Comprehensive logging system
24+
- Configuration management through preferences
25+
26+
### Technical
27+
- Java 21 compatibility
28+
- Gradle build system with shadow JAR packaging
29+
- JUnit 5 test framework integration
30+
- Jetty embedded server for MCP communication

docs/semantic-versioning-guide.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Semantic Versioning Guide for WigAI
2+
3+
This project uses [Semantic Versioning](https://semver.org/) with automated releases based on conventional commits.
4+
5+
## Commit Message Format
6+
7+
Use the [Conventional Commits](https://conventionalcommits.org/) specification:
8+
9+
```
10+
<type>[optional scope]: <description>
11+
12+
[optional body]
13+
14+
[optional footer(s)]
15+
```
16+
17+
## Commit Types and Version Impact
18+
19+
### PATCH Releases (0.2.0 → 0.2.1)
20+
Bug fixes that don't break existing functionality:
21+
22+
```bash
23+
git commit -m "fix: resolve null pointer exception in device controller"
24+
git commit -m "fix(mcp): handle connection timeout gracefully"
25+
git commit -m "fix(transport): correct play/pause state synchronization"
26+
```
27+
28+
### MINOR Releases (0.2.0 → 0.3.0)
29+
New features that are backward compatible:
30+
31+
```bash
32+
git commit -m "feat: add support for scene banking operations"
33+
git commit -m "feat(mcp): implement new device parameter tool"
34+
git commit -m "feat(ui): add configuration panel for MCP settings"
35+
```
36+
37+
### MAJOR Releases (0.2.0 → 1.0.0)
38+
Breaking changes that require user intervention:
39+
40+
```bash
41+
git commit -m "feat!: redesign MCP tool interface for better performance"
42+
43+
# Or with explicit breaking change footer:
44+
git commit -m "feat: change device API structure
45+
46+
BREAKING CHANGE: Device.getParameter() now returns Optional<Parameter> instead of Parameter"
47+
```
48+
49+
## Common Commit Types
50+
51+
- `fix:` - Bug fixes
52+
- `feat:` - New features
53+
- `docs:` - Documentation changes
54+
- `style:` - Code style changes (formatting, etc.)
55+
- `refactor:` - Code refactoring without feature changes
56+
- `test:` - Adding or updating tests
57+
- `chore:` - Maintenance tasks, dependency updates
58+
- `perf:` - Performance improvements
59+
- `ci:` - CI/CD configuration changes
60+
61+
## Scopes (Optional)
62+
63+
Use scopes to indicate the area of change:
64+
65+
- `mcp` - MCP server related changes
66+
- `transport` - Transport control functionality
67+
- `device` - Device parameter management
68+
- `clip` - Clip and scene management
69+
- `config` - Configuration management
70+
- `ui` - User interface changes
71+
- `api` - API changes
72+
73+
## Examples for WigAI
74+
75+
```bash
76+
# Bug fixes (PATCH)
77+
git commit -m "fix(mcp): resolve server startup race condition"
78+
git commit -m "fix(device): handle missing parameter gracefully"
79+
80+
# New features (MINOR)
81+
git commit -m "feat(transport): add support for tempo changes"
82+
git commit -m "feat(mcp): implement clip launch tool"
83+
84+
# Breaking changes (MAJOR)
85+
git commit -m "feat(api)!: change MCP tool response format"
86+
git commit -m "feat: restructure extension initialization
87+
88+
BREAKING CHANGE: WigAIExtension constructor now requires McpServerManager parameter"
89+
```
90+
91+
## Release Process
92+
93+
1. **Push to main branch** - Triggers automatic analysis
94+
2. **Semantic Release analyzes commits** - Determines version bump type
95+
3. **Version update** - Updates `build.gradle.kts` automatically
96+
4. **Changelog generation** - Updates `CHANGELOG.md`
97+
5. **GitHub release** - Creates release with artifacts
98+
6. **Git tag** - Tags the release (e.g., `v0.3.0`)
99+
100+
## No Release Scenarios
101+
102+
These commit types will NOT trigger a release:
103+
104+
```bash
105+
git commit -m "docs: update README with new features"
106+
git commit -m "style: fix code formatting"
107+
git commit -m "ci: update GitHub Actions workflow"
108+
git commit -m "chore: update dependencies"
109+
```
110+
111+
## Manual Release
112+
113+
If needed, you can manually trigger a release using GitHub Actions workflow dispatch, but it's recommended to use the commit-based approach for consistency.

0 commit comments

Comments
 (0)