diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d8ae2fb03..e412f4b3f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -4,10 +4,68 @@ name: Checks on: pull_request: +permissions: + contents: read + jobs: + + eval-changes: + name: Evaluate changes + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Evaluate | Check specific file types for changes + id: changed-files + uses: tj-actions/changed-files@v45.0.2 + with: + files_yaml: | + build: + - MANIFEST.in + - Dockerfile + - .dockerignore + - scripts/** + ci: + - .github/workflows/** + docs: + - docs/** + - README.rst + - AUTHORS.rst + - CONTRIBUTING.rst + - CHANGELOG.rst + src: + - semantic_release/** + - pyproject.toml + tests: + - tests/** + + - name: Evaluate | Detect if any of the combinations of file sets have changed + id: all-changes + run: | + printf '%s\n' "any_changed=false" >> $GITHUB_OUTPUT + if [ "${{ steps.changed-files.outputs.build_any_changed }}" == "true" ] || \ + [ "${{ steps.changed-files.outputs.ci_any_changed }}" == "true" ] || \ + [ "${{ steps.changed-files.outputs.docs_any_changed }}" == "true" ] || \ + [ "${{ steps.changed-files.outputs.src_any_changed }}" == "true" ] || \ + [ "${{ steps.changed-files.outputs.tests_any_changed }}" == "true" ]; then + printf '%s\n' "any_changed=true" >> $GITHUB_OUTPUT + fi + + outputs: + any-file-changes: ${{ steps.all-changes.outputs.any_changed }} + build-changes: ${{ steps.changed-files.outputs.build_any_changed }} + ci-changes: ${{ steps.changed-files.outputs.ci_any_changed }} + doc-changes: ${{ steps.changed-files.outputs.docs_any_changed }} + src-changes: ${{ steps.changed-files.outputs.src_any_changed }} + test-changes: ${{ steps.changed-files.outputs.tests_any_changed }} + + test-linux: name: Python ${{ matrix.python-version }} on ${{ matrix.os }} tests runs-on: ${{ matrix.os }} + needs: eval-changes + if: ${{ needs.eval-changes.outputs.src-changes == 'true' || needs.eval-changes.outputs.test-changes == 'true' || needs.eval-changes.outputs.ci-changes == 'true' }} strategy: matrix: python-version: @@ -66,6 +124,8 @@ jobs: test-windows: name: Python ${{ matrix.python-version }} on ${{ matrix.os }} tests runs-on: ${{ matrix.os }} + needs: eval-changes + if: ${{ needs.eval-changes.outputs.src-changes == 'true' || needs.eval-changes.outputs.test-changes == 'true' || needs.eval-changes.outputs.ci-changes == 'true' }} strategy: # Since the current test suite takes 10-15 minutes to complete on windows, we are # only going to run it on the oldest version of python we support. The older version @@ -122,7 +182,10 @@ jobs: report_paths: ./tests/reports/*.xml annotate_only: true + lint: + needs: eval-changes + if: ${{ needs.eval-changes.outputs.any-file-changes == 'true' }} runs-on: ubuntu-latest steps: @@ -147,6 +210,7 @@ jobs: - name: mypy run: python -m mypy --ignore-missing-imports semantic_release + commitlint: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4acf01e2e..842903553 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: # Linters and validation - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.6.1 hooks: - id: ruff name: ruff (lint) @@ -50,7 +50,7 @@ repos: name: ruff (format) - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.10.0" + rev: "v1.11.2" hooks: - id: mypy additional_dependencies: diff --git a/CHANGELOG.md b/CHANGELOG.md index 83681b66b..9fc9c6892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,47 @@ # CHANGELOG +## v9.8.9 (2024-09-27) + +### Documentation + +* docs: update docstrings to resolve sphinx failures (#1030) + +set `ignore-module-all` for `autodoc_default_options` to resolve some +Sphinx errors about duplicate / ambiguous references +https://github.com/sphinx-doc/sphinx/issues/4961#issuecomment-1543858623 + +Standardize some non-standard (Google-ish) docstrings to Sphinx +format, to avoid ruff and Sphinx arguing about underline length. + +Fix indents and other minor whitespace / formatting changes. + +Fixes #1029 ([`d84efc7`](https://github.com/python-semantic-release/python-semantic-release/commit/d84efc7719a8679e6979d513d1c8c60904af7384)) + +### Fix + +* fix(version-cmd): improve `version_variables` flexibility w/ quotes (ie. json, yaml, etc) (#1028) + +* fix(version-cmd): increase `version_variable` flexibility with quotations (ie. json, yaml, etc) + + Previously json would not work due to the key being wrapped in quotes, yaml also has issues + when it does not usually use quotes. The regex we created originally only wrapped the version + to be replaced in quotes but now both the key and version can optionally be wrapped in + different kind of quotations. + + Resolves: #601, #706, #962, #1026 + +* docs(configuration): add clarity to `version_variables` usage & limitations + + Ref: #941 + +* fix(version-cmd): ensure `version_variables` do not match partial variable names + +* build(deps-test): add `PyYAML` as a test dependency + +* test(fixtures): refactor location of fixture for global use of cli runner + +* test(stamp-version): add test cases to stamp json, python, & yaml files ([`156915c`](https://github.com/python-semantic-release/python-semantic-release/commit/156915c7d759098f65cf9de7c4e980b40b38d5f1)) + ## v9.8.8 (2024-09-01) ### Documentation diff --git a/README.rst b/README.rst index 70167f553..c8fdd9f14 100644 --- a/README.rst +++ b/README.rst @@ -1,50 +1,22 @@ Python Semantic Release *********************** -|Ruff| |Test Status| |PyPI Version| |conda-forge version| |Read the Docs Status| |Pre-Commit Enabled| +*Automating Releases via SemVer and Commit Message Conventions* -Automatic Semantic Versioning for Python projects. This is a Python -implementation of `semantic-release`_ for JS by Stephan Bönnemann. If -you find this topic interesting you should check out his `talk from -JSConf Budapest`_. +---- -The general idea is to be able to detect what the next version of the -project should be based on the commits. This tool will use that to -automate the whole release, upload to an artifact repository and post changelogs to -GitHub. You can run the tool on a CI service, or just run it locally. +The official documentation for Python Semantic Release can be found at +`python-semantic-release.readthedocs.io`_. -Installation -============ +GitHub Action +============= -:: +When using the Python Semantic Release GitHub Action, it executes the command +``semantic-release version`` using `python-semantic-release`_. - python3 -m pip install python-semantic-release - semantic-release --help +The usage information and examples for this GitHub Action is available under +the `GitHub Actions section`_ of `python-semantic-release.readthedocs.io`_. -Python Semantic Release is also available from `conda-forge`_ or as a `GitHub Action`_. -Read more about the setup and configuration in our `getting started guide`_. - -.. _semantic-release: https://github.com/semantic-release/semantic-release -.. _talk from JSConf Budapest: https://www.youtube.com/watch?v=tc2UgG5L7WM -.. _getting started guide: https://python-semantic-release.readthedocs.io/en/latest/#getting-started -.. _GitHub Action: https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html -.. _conda-forge: https://anaconda.org/conda-forge/python-semantic-release - -.. |Test Status| image:: https://img.shields.io/github/actions/workflow/status/python-semantic-release/python-semantic-release/main.yml?branch=master&label=Test%20Status&logo=github - :target: https://github.com/python-semantic-release/python-semantic-release/actions/workflows/main.yml - :alt: test-status -.. |PyPI Version| image:: https://img.shields.io/pypi/v/python-semantic-release?label=PyPI&logo=pypi - :target: https://pypi.org/project/python-semantic-release/ - :alt: pypi -.. |conda-forge Version| image:: https://img.shields.io/conda/vn/conda-forge/python-semantic-release?logo=anaconda - :target: https://anaconda.org/conda-forge/python-semantic-release - :alt: conda-forge -.. |Read the Docs Status| image:: https://img.shields.io/readthedocs/python-semantic-release?label=Read%20the%20Docs&logo=Read%20the%20Docs - :target: https://python-semantic-release.readthedocs.io/en/latest/ - :alt: docs -.. |Pre-Commit Enabled| image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit - :target: https://github.com/pre-commit/pre-commit - :alt: pre-commit -.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json - :target: https://github.com/astral-sh/ruff - :alt: Ruff +.. _python-semantic-release: https://pypi.org/project/python-semantic-release/ +.. _python-semantic-release.readthedocs.io: https://python-semantic-release.readthedocs.io/en/latest/ +.. _GitHub Actions section: https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html diff --git a/action.yml b/action.yml index 13ea3593b..dd3c1547f 100644 --- a/action.yml +++ b/action.yml @@ -1,7 +1,10 @@ --- name: Python Semantic Re