Skip to content

Commit

Permalink
Refactor GitHub Actions workflow to trigger on specific release event…
Browse files Browse the repository at this point in the history
…s and update setup.py for dynamic version retrieval
  • Loading branch information
Maralai committed Dec 15, 2024
1 parent 5c8c425 commit a858c46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish to PyPI

on:
release:
types: [published, created, edited, released]
types: [published, released]
# Optionally, you can also trigger on tags
push:
tags:
Expand All @@ -11,6 +11,7 @@ on:

jobs:
deploy:
if: startsWith(github.ref, 'refs/tags/v') # Only run on version tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

# Get version from git tag
version = os.environ.get('GITHUB_REF_NAME', '0.0.0').lstrip('v')
# Get version from git tag with fallback
def get_version():
version = os.environ.get('GITHUB_REF_NAME')
if version and version.startswith('v'):
return version.lstrip('v')
return '0.0.0' # fallback version

setup(
name="SummarizeGPT",
version=version,
version=get_version(),
author="Matt Harrison",
author_email="matt@harrison.consulting",
description="Tool to summarize directories of code for prompting with LLMs",
Expand Down

0 comments on commit a858c46

Please sign in to comment.