diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75050b2..d603771 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,11 @@ jobs: with: persist-credentials: false + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + node-version: '16' + - name: Semantic Release uses: cycjimmy/semantic-release-action@v4 id: semantic @@ -50,6 +55,18 @@ jobs: GIT_AUTHOR_NAME: github-actions[bot] GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com + - name: Update __about__ + if: steps.semantic.outputs.new_release_published == 'true' + run: | + npx semantic-release exec -- cmd /c "echo __version__ = '${{ steps.semantic.outputs.new_release_version }}' > __version__.py" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add __version__.py + git commit -m "chore: [gh] Update __version__.py to ${{ steps.semantic.outputs.new_release_version }}" + git push https://${{ secrets.PAT }}@github.com/${{ github.repository }}.git HEAD:main + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + - name: Publish To GitHub Package Registry if: steps.semantic.outputs.new_release_published == 'true' run: echo "new release was published" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c5dd84..2b03dbc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,6 +46,7 @@ repos: rev: 6.0.0 hooks: - id: flake8 + args: [--ignore=D100] additional_dependencies: [ 'flake8-blind-except', 'flake8-bugbear', diff --git a/__about__.py b/__about__.py index a3d6347..c058e48 100644 --- a/__about__.py +++ b/__about__.py @@ -5,15 +5,8 @@ Python Secure Logger """ -# Increment this version number to trigger a new release. See -# CHANGELOG.md for information on the versioning scheme. -__version__ = "0.1.6" - # The app name will be used to define the name of the default plugin root and # plugin directory. To avoid conflicts between multiple locally-installed # versions, if it is defined the version suffix will also be appended to the app # name. __app__ = "secure_logger" - -# Package version, as installed by pip, does not include the version suffix. -__package_version__ = __version__ diff --git a/secure_logger/__version__.py b/secure_logger/__version__.py new file mode 100644 index 0000000..f15538a --- /dev/null +++ b/secure_logger/__version__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +__version__ = "0.1.6" diff --git a/setup.py b/setup.py index 4a26a4b..88261e9 100644 --- a/setup.py +++ b/setup.py @@ -72,13 +72,22 @@ def load_about() -> Dict[str, str]: return about +def load_version() -> Dict[str, str]: + """Stringify the __about__ mobule.""" + version: Dict[str, str] = {} + with io.open(os.path.join(HERE, "__version__.py"), "rt", encoding="utf-8") as f: + exec(f.read(), version) # pylint: disable=exec-used + return version + + README = open(os.path.join(os.path.dirname(__file__), "README.md")).read() CHANGELOG = open(os.path.join(os.path.dirname(__file__), "CHANGELOG.md")).read() ABOUT = load_about() +VERSION = load_version() setup( name="secure-logger", - version=ABOUT["__package_version__"], + version=VERSION["__version__"], description="A decorator to generate redacted and nicely formatted log entries", long_description=load_readme(), author="Lawrence McDaniel",