Skip to content

Commit

Permalink
fix: versioning for build process
Browse files Browse the repository at this point in the history
  • Loading branch information
cafadev committed Oct 12, 2023
1 parent 315bc8c commit 1d6057a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ jobs:
- name: Install deps
run: poetry install

- name: Run matic-release
run: poetry run python scripts/release.py --ci

- name: Build a binary wheel and a source tarball
run: python3 -m build
run: poetry run python setup.py sdist

- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Run matic-release
run: poetry run python scripts/release.py --ci

- name: Publish tag
run: git push --tags

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
__pycache__
dist
13 changes: 12 additions & 1 deletion scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import sys
from matic_release.axioma.version import Version
from matic_release.capabilities.commit_analyzer import CommitAnalyzer
Expand All @@ -6,6 +7,12 @@
from matic_release.integration.git import GitService


def output_file(version: str):
with open('./turbobus/version_output.json', 'w') as f:
json.dump({ "version": version }, f)
f.close()


args = sys.argv[1:]
git = GitService()

Expand All @@ -23,4 +30,8 @@
publish = PublishTag(git)
publish.execute(version)

print(version.future_tag.value)

output_file(version.future_tag.value)

print(version.future_tag.value)

26 changes: 11 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
import sys
import json
from setuptools import setup
readme = open("./README.md", "r")

from matic_release.axioma.version import Version
from matic_release.capabilities.commit_analyzer import CommitAnalyzer
from matic_release.capabilities.compute_tag import ComputeTag
from matic_release.capabilities.publish_tag import PublishTag
from matic_release.integration.git import GitService

git = GitService()
json_data = {}

latest_tag = git.get_latest_tag()
with open('./turbobus/version_output.json') as f:
json_data = json.load(f)

version = Version(latest_tag)

version = json_data.get('version')

commit_analyzer = CommitAnalyzer()
compute_tag = ComputeTag(git, commit_analyzer)

compute_tag.execute(version)
print(version)

if version is None:
raise Exception('Unprocessable without version')

setup(
name='turbobus',
packages=['turbobus'],
version=version.future_tag.value,
version=version,
description='TurboBus is an opinionated implementation of Command Responsibility Segregation pattern in python.',
long_description=readme.read(),
long_description_content_type='text/markdown',
author='Christopher A. Flores',
author_email='cafadev@outlook.com',

url='https://github.com/cafadev/turbobus',
download_url=f'https://github.com/cafadev/turbobus/releases/tag/v{version.future_tag.value}',
download_url=f'https://github.com/cafadev/turbobus/releases/tag/v{version}',
keywords=['command', 'bus', 'cqrs', 'commandbus', 'ddd'],
classifiers=[ ],
license='MIT',
Expand Down

0 comments on commit 1d6057a

Please sign in to comment.