Skip to content

Commit

Permalink
Merge pull request #22 from tawanda-kembo/ci/streamline-release-process
Browse files Browse the repository at this point in the history
ci: fix version updating and PyPI publishing process
  • Loading branch information
tawandakembo authored Jul 27, 2024
2 parents a11894e + 5cbfc08 commit 7afaceb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -74,7 +76,7 @@ jobs:
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: ${{ secrets.PYPI_PASSWORD }}
password: ${{ secrets.PYPI_PASSWORD }}
7 changes: 6 additions & 1 deletion bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ else
fi

# Set the output variable for the new version
echo "::set-output name=NEW_VERSION::v$NEW_VERSION"
echo "::set-output name=NEW_VERSION::v$NEW_VERSION"

# Commit the version bump
git add setup.py
git commit -m "Bump version to $NEW_VERSION"
git push origin main
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from setuptools import setup, find_packages
import pathlib
import subprocess

here = pathlib.Path(__file__).parent.resolve()

def get_version():
try:
version = subprocess.check_output(['git', 'describe', '--tags']).decode().strip()
return version.lstrip('v')
except:
return '0.0.0'

setup(
name="code-collator",
version="0.1",
version=get_version(),
description="A CLI tool to aggregate codebase into a single Markdown file",
long_description=(here / 'README.md').read_text(encoding='utf-8'),
long_description_content_type='text/markdown',
url="https://github.com/tawanda-kembo/code-collator",
author="Tawanda Kembo",
author_email="tkembo@gmail.com",
author_email="tawanda@mrkembo.com",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
Expand Down

0 comments on commit 7afaceb

Please sign in to comment.