Skip to content

Commit

Permalink
fix: add auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
cafadev committed Oct 12, 2023
1 parent fe3e6bb commit 697dd2a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 8 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:

compute-new-tag-version:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -40,6 +40,15 @@ jobs:
- name: Install deps
run: poetry install

- name: Build a binary wheel and a source tarball
run: python3 -m build

- 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

Expand All @@ -50,11 +59,29 @@ jobs:
id: toTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/turbobus
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

generate-release:
runs-on: ubuntu-latest
needs:
- compute-new-tag-version
if: ${{ needs.compute-new-tag-version.outputs.fromTag != needs.compute-new-tag-version.outputs.toTag }}
- build
if: ${{ needs.build.outputs.fromTag != needs.build.outputs.toTag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
Expand All @@ -77,4 +104,4 @@ jobs:
with:
body: ${{ env.CHANGELOG }}
prerelease: true
tag_name: ${{ needs.compute-new-tag-version.outputs.toTag }}
tag_name: ${{ needs.build.outputs.toTag }}
35 changes: 34 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ python = "^3.11"
pytest = "^7.4.2"
matic-release = {git = "https://github.com/fancy-crud/matic-release.git"}
twine = "^4.0.2"
build = "^1.0.3"

[build-system]
requires = ["poetry-core"]
Expand Down
23 changes: 20 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
import sys
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()

latest_tag = git.get_latest_tag()

version = Version(latest_tag)

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

compute_tag.execute(version)


setup(
name='turbobus',
packages=['turbobus'],
version='1.0.0-alpha.1',
version=version.future_tag.value,
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='https://github.com/cafadev/turbobus/releases/tag/v1.0.0-alpha.1',
download_url=f'https://github.com/cafadev/turbobus/releases/tag/v{version.future_tag.value}',
keywords=['command', 'bus', 'cqrs', 'commandbus', 'ddd'],
classifiers=[ ],
license='MIT',
Expand Down

0 comments on commit 697dd2a

Please sign in to comment.