diff --git a/.github/COPILOT_INSTRUCTIONS.md b/.github/COPILOT_INSTRUCTIONS.md index 54c8a93..4f52273 100644 --- a/.github/COPILOT_INSTRUCTIONS.md +++ b/.github/COPILOT_INSTRUCTIONS.md @@ -27,9 +27,9 @@ This is a **Home Assistant custom component** for integrating MiniBrew Craft and 1. **Automatic Release** (`.github/workflows/release.yml`) - Triggers on push to main - - Uses semantic-release to determine version from commits - - Waits for all validation checks to pass before releasing - - Updates manifest.json version automatically + - Waits for all validation checks to pass, then runs Release Please + - Release Please opens/updates a release PR with the version bump (manifest.json) and CHANGELOG.md entry + - Merging the release PR tags the commit and publishes the GitHub release 2. **Draft Release** (`.github/workflows/draft-release.yml`) - Manual workflow dispatch or preview tags (v*-preview*, v*-beta*, v*-alpha*, v*-rc*) @@ -73,7 +73,7 @@ This is a **Home Assistant custom component** for integrating MiniBrew Craft and ### 8. Dependencies & Tools - **Dependabot** configured for GitHub Actions and Python dependencies -- **Semantic-release** for version management +- **Release Please** for version management and release PRs - **Commitlint** for commit message validation - **Git hooks** for local validation (scripts/commit-msg) @@ -85,7 +85,7 @@ This is a **Home Assistant custom component** for integrating MiniBrew Craft and ### 10. Key Files to Never Modify Without Care - `manifest.json` - Must maintain exact structure and ordering -- `pyproject.toml` - Semantic-release configuration +- `release-please-config.json` / `.release-please-manifest.json` - Release Please configuration - `.commitlintrc.json` - Commit validation rules - Workflow files - Critical for CI/CD @@ -125,26 +125,26 @@ Always include when relevant: - Main branch is protected - All changes via PRs - PRs require conventional commit titles -- Auto-release on merge to main +- Release Please opens/updates a release PR; merging it tags and publishes the release - Draft releases for manual review - Preview releases for PR testing ## Development Setup - Run `./scripts/setup-dev.sh` for environment setup - Installs git hooks for commit validation -- Optional: semantic-release and commitlint tools +- Optional: commitlint tools ## When Making Changes 1. Always follow conventional commits 2. Update relevant documentation 3. Ensure validation checks pass 4. Consider if README needs updating -5. Check if manifest.json needs version bump (auto-handled by semantic-release) +5. Check if manifest.json needs version bump (auto-handled by Release Please) 6. No emojis anywhere ## File Paths Reference - Integration: `custom_components/minibrew/` - Workflows: `.github/workflows/` - Docs: `README.md`, `CONTRIBUTING.md`, `.github/RELEASE_WORKFLOWS.md` -- Config: `pyproject.toml`, `.commitlintrc.json`, `.github/dependabot.yml` +- Config: `release-please-config.json`, `.release-please-manifest.json`, `.commitlintrc.json`, `.github/dependabot.yml` - Scripts: `scripts/commit-msg`, `scripts/setup-dev.sh` diff --git a/.github/RELEASE_WORKFLOWS.md b/.github/RELEASE_WORKFLOWS.md index 58b5fa5..881a5cc 100644 --- a/.github/RELEASE_WORKFLOWS.md +++ b/.github/RELEASE_WORKFLOWS.md @@ -9,17 +9,15 @@ This project has three release workflows: **Triggers:** Automatically on every push to `main` branch **What it does:** -- Uses semantic-release to analyze commit messages -- Automatically determines version number based on commit types -- Creates and publishes release immediately -- Updates manifest.json version -- Generates changelog from commits +- Uses [Release Please](https://github.com/googleapis/release-please) to analyze commit messages +- Opens or updates a standing "chore(main): release X.Y.Z" pull request containing the version bump (`custom_components/minibrew/manifest.json`) and a `CHANGELOG.md` entry +- Only tags the release and publishes the GitHub release once that pull request is merged to `main` **Version bump rules:** - Minor: `feat` - Patch: `fix`, `perf`, `ci`, `build`, `chore` -**Usage:** Just merge your PR to main with proper conventional commit messages. +**Usage:** Merge your PR to main with proper conventional commit messages, then review and merge the release PR that Release Please opens/updates to actually cut the release. --- diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 57a3f15..ab4176b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,25 +17,3 @@ updates: - "github-actions" reviewers: - "stuartp44" - - # Python dependencies - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "weekly" - day: "monday" - time: "09:00" - open-pull-requests-limit: 5 - commit-message: - prefix: "build" - prefix-development: "build" - include: "scope" - labels: - - "dependencies" - - "python" - reviewers: - - "stuartp44" - ignore: - # Ignore patch updates for stable dependencies - - dependency-name: "python-semantic-release" - update-types: ["version-update:semver-patch"] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 226d7ae..d6fadfb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,52 +89,14 @@ jobs: - name: Validate current commit run: echo "${{ github.event.head_commit.message }}" | commitlint - release: + release-please: runs-on: ubuntu-latest needs: [validate-hacs, validate-hassfest, validate-manifest, validate-commits] - + steps: - - name: Checkout code - uses: actions/checkout@v7 + - name: Release Please + uses: googleapis/release-please-action@v4 with: - fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Python - uses: actions/setup-python@v7 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install python-semantic-release "GitPython<3.1.60" - - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Semantic Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - semantic-release version - semantic-release publish - - - name: Update manifest.json version - if: success() - run: | - VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//') - python -c " - import json - with open('custom_components/minibrew/manifest.json', 'r+') as f: - data = json.load(f) - data['version'] = '${VERSION}' - f.seek(0) - json.dump(data, f, indent=2) - f.truncate() - " - git add custom_components/minibrew/manifest.json - git commit -m "chore: update manifest version to ${VERSION}" || echo "No changes to commit" - git push origin main || echo "No changes to push" + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..78e7f27 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.11.0" +} diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 0252cdf..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,44 +0,0 @@ -[tool.semantic_release] -version_toml = ["pyproject.toml:tool.semantic_release.version"] -version_variables = [] -version = "0.11.0" -build_command = "" -commit_message = "chore(release): {version}" -commit_parser = "conventional" -tag_format = "v{version}" -major_on_zero = true -allow_zero_version = true - -[tool.semantic_release.branches.main] -match = "main" -prerelease = false - -[tool.semantic_release.changelog] -exclude_commit_patterns = [] - -[tool.semantic_release.changelog.default_templates] -changelog_file = "CHANGELOG.md" -template_dir = ".github/release_templates" - -[tool.semantic_release.changelog.environment] -keep_trailing_newline = true - -[tool.semantic_release.commit_parser_options] -allowed_tags = [ - "feat", - "fix", - "docs", - "style", - "refactor", - "perf", - "test", - "build", - "ci", - "chore", - "revert" -] -minor_tags = ["feat"] -patch_tags = ["fix", "perf", "ci", "build", "chore"] - -[tool.semantic_release.remote] -type = "github" diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..537006a --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "simple", + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "json", + "path": "custom_components/minibrew/manifest.json", + "jsonpath": "$.version" + } + ], + "changelog-sections": [ + { "type": "feat", "section": "Added" }, + { "type": "fix", "section": "Fixed" }, + { "type": "perf", "section": "Changed" }, + { "type": "refactor", "section": "Changed" }, + { "type": "docs", "section": "Changed", "hidden": false }, + { "type": "chore", "section": "Changed", "hidden": true }, + { "type": "style", "section": "Changed", "hidden": true }, + { "type": "test", "section": "Changed", "hidden": true }, + { "type": "build", "section": "Changed", "hidden": true }, + { "type": "ci", "section": "Changed", "hidden": true }, + { "type": "revert", "section": "Changed" } + ] + } + } +} diff --git a/scripts/setup-dev.sh b/scripts/setup-dev.sh index 2c2d2cf..ed8aa3f 100755 --- a/scripts/setup-dev.sh +++ b/scripts/setup-dev.sh @@ -22,20 +22,6 @@ else echo "Warning: .git directory not found, skipping Git hooks" fi -# Install Python dependencies (optional) -echo "" -echo "Python development dependencies..." -read -p "Do you want to install Python semantic-release tools? (y/n) " -n 1 -r -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then - if command -v pip &> /dev/null; then - pip install python-semantic-release - echo "Python semantic-release installed" - else - echo "Warning: pip not found, skipping Python dependencies" - fi -fi - # Install Node.js dependencies for commitlint (optional) echo "" echo "Node.js development dependencies..."