Skip to content

Commit

Permalink
Merge pull request #10 from lpm0073/next
Browse files Browse the repository at this point in the history
automate PyPi version number bump
  • Loading branch information
lpm0073 authored Nov 13, 2023
2 parents 19b587f + f53f798 commit 642f069
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@ jobs:
with:
persist-credentials: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Get current version
id: current_version
run: |
echo "::set-output name=version::$(python -c 'from __version__ import __version__; print(__version__)')"
- name: Get next version
id: next_version
run: |
echo "::set-output name=version::$(npx semantic-release --dry-run | grep 'The next release version is' | cut -d ' ' -f6)"
- name: Update __version__
if: steps.current_version.outputs.version != steps.next_version.outputs.version
run: |
echo "__version__ = '${{ steps.next_version.outputs.version }}'" > __version__.py
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add __version__.py
git commit -m "chore: [gh] Update __version__.py to ${{ steps.next_version.outputs.version }}"
git push https://${{ secrets.PAT }}@github.com/${{ github.repository }}.git HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
args: [--ignore=D100]
additional_dependencies: [
'flake8-blind-except',
'flake8-bugbear',
Expand Down
7 changes: 0 additions & 7 deletions __about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
2 changes: 2 additions & 0 deletions secure_logger/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = "0.1.6"
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ deps = -rrequirements.txt
commands = pytest

[flake8]
ignore = D205,D400,D401,D403,D413
ignore = D100,D205,D400,D401,D403,D413
max-line-length =120
max-complexity = 10

Expand Down

0 comments on commit 642f069

Please sign in to comment.