From c4d3f16ad8dc009d08feab3ff0df8c2aec42ec19 Mon Sep 17 00:00:00 2001 From: Fabian Ehrentraud Date: Mon, 2 Jun 2025 16:17:19 +0200 Subject: [PATCH] feat: automatic semantic version bumps on release --- .github/workflows/ci.yml | 36 ++++++++++ .github/workflows/release.yml | 93 ++++++++++++------------ CHANGELOG.md | 30 ++++++++ docs/semantic-versioning-guide.md | 113 ++++++++++++++++++++++++++++++ 4 files changed, 222 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 CHANGELOG.md create mode 100644 docs/semantic-versioning-guide.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0dfd2cd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: CI + +on: + pull_request: # Run on pull requests + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Run tests + run: ./gradlew test + + - name: Build extension + run: ./gradlew bwextension + + - name: Upload extension artifact + uses: actions/upload-artifact@v4 + with: + name: WigAI.bwextension-pr-${{ github.event.number || github.sha }} + path: build/extensions/WigAI.bwextension + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c03bf55..e916d61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,21 +1,24 @@ name: Release Extension on: - workflow_dispatch: # Allows manual triggering - pull_request: # Run on pull requests -# push: -# branches: -# - main # Triggers on pushes to the main branch + push: + branches: [main] # Automatic releases on main branch + workflow_dispatch: # Manual triggering permissions: contents: write + issues: write + pull-requests: write jobs: - build: + release: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch full history for semantic-release + token: ${{ secrets.GITHUB_TOKEN }} - name: Set up JDK 21 uses: actions/setup-java@v4 @@ -26,57 +29,47 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@v4 - - name: Build extension - run: ./gradlew bwextension - - - name: Upload extension artifact - uses: actions/upload-artifact@v4 - with: - name: WigAI.bwextension - path: build/extensions/WigAI.bwextension - - release: - runs-on: ubuntu-latest - needs: build - if: github.event_name == 'workflow_dispatch' - # || (github.event_name == 'push' && github.ref == 'refs/heads/main') - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for changelog generation - - - name: Download extension artifact - uses: actions/download-artifact@v4 - with: - name: WigAI.bwextension - path: . # Download directly into the current workspace directory - - - name: Set up Node.js + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 'lts/*' - - name: Install conventional-changelog-cli - run: npm install -g conventional-changelog-cli conventional-commits-parser + - name: Install semantic-release + run: | + npm install -g semantic-release + npm install -g @semantic-release/changelog + npm install -g @semantic-release/git + npm install -g @semantic-release/github + npm install -g @semantic-release/exec + + - name: Run tests + run: ./gradlew test - - name: Generate release notes - run: conventional-changelog -p angular -i CHANGELOG.md -s -r 0 > RELEASE_NOTES.md && cat RELEASE_NOTES.md + - name: Run semantic-release + run: semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get project version - id: get_version - run: echo "PROJECT_VERSION=$(./gradlew -q printVersion)" >> $GITHUB_ENV + - name: Build extension (if version was bumped) + if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true' + run: ./gradlew bwextension - - name: Generate tag name - id: generate_tag # id is not strictly needed here as we are using GITHUB_ENV but good practice - run: echo "TAG_NAME=release-${{ env.PROJECT_VERSION }}-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV + - name: Get release info for asset upload + if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true' + id: release_info + run: | + RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ env.SEMANTIC_RELEASE_VERSION }}" \ + | jq -r '.id') + echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ env.TAG_NAME }} - name: Release ${{ env.TAG_NAME }} - body_path: RELEASE_NOTES.md - files: WigAI.bwextension # Updated path + - name: Upload extension to release + if: env.SEMANTIC_RELEASE_NEW_RELEASE_PUBLISHED == 'true' + uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.release_info.outputs.release_id }}/assets{?name,label} + asset_path: build/extensions/WigAI.bwextension + asset_name: WigAI.bwextension + asset_content_type: application/java-archive diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..be63f1b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.2.0] - 2025-02-06 + +### Added +- Initial WigAI extension for Bitwig Studio +- MCP (Model Context Protocol) server integration +- Device parameter control tools +- Transport control functionality +- Clip and scene management tools +- Status monitoring capabilities + +### Features +- Real-time parameter manipulation through MCP tools +- RESTful API for external control +- Comprehensive logging system +- Configuration management through preferences + +### Technical +- Java 21 compatibility +- Gradle build system with shadow JAR packaging +- JUnit 5 test framework integration +- Jetty embedded server for MCP communication \ No newline at end of file diff --git a/docs/semantic-versioning-guide.md b/docs/semantic-versioning-guide.md new file mode 100644 index 0000000..29dd3f8 --- /dev/null +++ b/docs/semantic-versioning-guide.md @@ -0,0 +1,113 @@ +# Semantic Versioning Guide for WigAI + +This project uses [Semantic Versioning](https://semver.org/) with automated releases based on conventional commits. + +## Commit Message Format + +Use the [Conventional Commits](https://conventionalcommits.org/) specification: + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +## Commit Types and Version Impact + +### PATCH Releases (0.2.0 → 0.2.1) +Bug fixes that don't break existing functionality: + +```bash +git commit -m "fix: resolve null pointer exception in device controller" +git commit -m "fix(mcp): handle connection timeout gracefully" +git commit -m "fix(transport): correct play/pause state synchronization" +``` + +### MINOR Releases (0.2.0 → 0.3.0) +New features that are backward compatible: + +```bash +git commit -m "feat: add support for scene banking operations" +git commit -m "feat(mcp): implement new device parameter tool" +git commit -m "feat(ui): add configuration panel for MCP settings" +``` + +### MAJOR Releases (0.2.0 → 1.0.0) +Breaking changes that require user intervention: + +```bash +git commit -m "feat!: redesign MCP tool interface for better performance" + +# Or with explicit breaking change footer: +git commit -m "feat: change device API structure + +BREAKING CHANGE: Device.getParameter() now returns Optional instead of Parameter" +``` + +## Common Commit Types + +- `fix:` - Bug fixes +- `feat:` - New features +- `docs:` - Documentation changes +- `style:` - Code style changes (formatting, etc.) +- `refactor:` - Code refactoring without feature changes +- `test:` - Adding or updating tests +- `chore:` - Maintenance tasks, dependency updates +- `perf:` - Performance improvements +- `ci:` - CI/CD configuration changes + +## Scopes (Optional) + +Use scopes to indicate the area of change: + +- `mcp` - MCP server related changes +- `transport` - Transport control functionality +- `device` - Device parameter management +- `clip` - Clip and scene management +- `config` - Configuration management +- `ui` - User interface changes +- `api` - API changes + +## Examples for WigAI + +```bash +# Bug fixes (PATCH) +git commit -m "fix(mcp): resolve server startup race condition" +git commit -m "fix(device): handle missing parameter gracefully" + +# New features (MINOR) +git commit -m "feat(transport): add support for tempo changes" +git commit -m "feat(mcp): implement clip launch tool" + +# Breaking changes (MAJOR) +git commit -m "feat(api)!: change MCP tool response format" +git commit -m "feat: restructure extension initialization + +BREAKING CHANGE: WigAIExtension constructor now requires McpServerManager parameter" +``` + +## Release Process + +1. **Push to main branch** - Triggers automatic analysis +2. **Semantic Release analyzes commits** - Determines version bump type +3. **Version update** - Updates `build.gradle.kts` automatically +4. **Changelog generation** - Updates `CHANGELOG.md` +5. **GitHub release** - Creates release with artifacts +6. **Git tag** - Tags the release (e.g., `v0.3.0`) + +## No Release Scenarios + +These commit types will NOT trigger a release: + +```bash +git commit -m "docs: update README with new features" +git commit -m "style: fix code formatting" +git commit -m "ci: update GitHub Actions workflow" +git commit -m "chore: update dependencies" +``` + +## Manual Release + +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. \ No newline at end of file