Skip to content

Commit

Permalink
feat: add tags and automatic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Wazzabeee committed Apr 21, 2024
1 parent 8aacf88 commit 75e94a1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
44 changes: 27 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,30 @@ jobs:
continue-on-error: true

release:
needs: [ test, good-practices ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.5'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
needs: [test, good-practices]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: auto
MAJOR_PATTERN: '^BREAKING CHANGE:'
MINOR_PATTERN: '^feat:'
PATCH_PATTERN: '^fix:'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.5'
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import subprocess
from setuptools import setup, find_packages

with open("VERSION") as version_file:
version = version_file.read().strip()

def get_version():
try:
# Get the latest tag from Git
version = subprocess.check_output(["git", "describe", "--tags"]).strip().decode("utf-8")
except Exception:
version = "0.1.0"
return version


setup(
name="copy-spotter",
version=version,
version=get_version(),
packages=find_packages(),
install_requires=[
"beautifulsoup4==4.10.0",
Expand Down

0 comments on commit 75e94a1

Please sign in to comment.