Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature logging #2

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Publish Python Package
name: Build and Test Python Package

on:
pull_request:
branches:
- '**' # Triggers on all branches with open PRs

push:
branches:
- master
- master # Triggers on pushes to the main branch

jobs:
build-and-publish:
build-and-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -19,18 +23,48 @@ jobs:
python-version: '3.x'

- name: Install dependencies
run: pip install -r requirements.txt
run: |
pip install setuptools wheel
pip install -r requirements.txt

- name: Get current version
id: get_version
run: |
VERSION=$(python -c "exec(open('setup.py').read()); print(__version__)")
VERSION=$(python -c "from version import __version__; print(__version__)")
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Build the package
run: |
python setup.py sdist bdist_wheel

# - name: Run tests
# run: |
# pip install pytest
# pytest

publish-and-tag:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build-and-test

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
pip install setuptools wheel
pip install -r requirements.txt

- name: Build the package
run: |
python setup.py sdist bdist_wheel

- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -40,10 +74,8 @@ jobs:
twine upload dist/*

- name: Create Git tag
if: success()
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag -a v${{ env.VERSION }} -m "Release version ${{ env.VERSION }}"
git push origin v${{ env.VERSION }}

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from setuptools import setup, find_packages
from version import __version__

__version__ = "0.2.0"

Expand Down
2 changes: 2 additions & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# version.py
__version__ = "0.2.0"
Loading