diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5e88b1..ae69a8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,3 +64,83 @@ jobs: activate-environment: true - name: Build package run: uv build + + # Test semantic-release configuration on PR branches + test-release: + name: Test Semantic Release + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Setup Git for Semantic Release Testing + run: | + # Setup a temp branch to test + git checkout -B temp-main-branch + git merge ${{ github.event.pull_request.head.sha }} --no-edit + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + - name: Test Semantic Release (No-op) + id: test-release + uses: python-semantic-release/python-semantic-release@v10.5.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + changelog: true + # Use noop mode to test without making changes + no_operation_mode: true + - name: Test Semantic Release (Dry Run) + id: test-release-dry + uses: python-semantic-release/python-semantic-release@v10.5.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + changelog: true + # Use dry run mode to test without committing + commit: false + tag: false + push: false + vcs_release: false + release: + runs-on: ubuntu-latest + needs: + - test + concurrency: release + if: github.ref == 'refs/heads/main' + permissions: + contents: write + issues: write + pull-requests: write + id-token: write + actions: write + packages: write + environment: + name: release + + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + - name: Python Semantic Release + id: release + uses: python-semantic-release/python-semantic-release@v10.5.3 + with: + github_token: ${{ secrets.GH_TOKEN }} + changelog: true + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.13.0 + # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. + # See https://github.com/actions/runner/issues/1173 + if: steps.release.outputs.released == 'true' + with: + packages-dir: dist + print-hash: true + verbose: true + + - name: Publish package distributions to GitHub Releases + uses: python-semantic-release/publish-action@v10.5.3 + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.release.outputs.tag }} diff --git a/commitlint.config.mjs b/commitlint.config.mjs index ad7b85d..b5e0107 100644 --- a/commitlint.config.mjs +++ b/commitlint.config.mjs @@ -8,7 +8,11 @@ export default { // Disable the rule that enforces lowercase in subject "subject-case": [0], // 0 = disable, 1 = warn, 2 = error // Disable the rule that enforces a maximum line length in the body - "body-max-line-length": [0, "always"] + "body-max-line-length": [0, "always"], + // Disable header max length for AI-generated commits + "header-max-length": [0], + // Disable the rule that prevents periods at the end of subjects + "header-full-stop": [0] }, }; diff --git a/pyproject.toml b/pyproject.toml index 57e0f4a..974eb89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ dev = [ [tool.semantic_release] branch = "main" version_toml = ["pyproject.toml:project.version"] -build_command = "pip install uv && uv lock --upgrade-package python-roborock && git add uv.lock && uv build" +build_command = "pip install uv && uv lock --upgrade-package harbor-python && git add uv.lock && uv build" changelog_file = 'CHANGELOG.md' commit = true @@ -53,6 +53,16 @@ commit = true match = "main" prerelease = false +[tool.semantic_release.commit_parser_options] +allowed_tags = [ + "chore", + "docs", + "feat", + "fix", + "refactor" +] +major_tags= ["refactor"] + [tool.ruff] lint.ignore = ["F403", "E741"] lint.select=["E", "F", "UP", "I"]