tryihng a fix for python 3.12 pip pkg error #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Version Bumping | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Important to fetch all history for version tags and commits | |
# This step checks out the repository code | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
# This step sets up the Python environment | |
- name: Install pip correct version | |
run: python -m ensurepip --upgrade | |
- name: Install bumpversion | |
run: pip install bump2version | |
# This step installs the bump2version package | |
- name: Configure Git | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
# This step configures Git with a dummy email and name | |
- name: Get last commit message | |
id: get-commit-message | |
run: echo "message=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT | |
# This step retrieves the last commit message and sets it as an output | |
- name: Determine version bump type | |
id: version-bump-type | |
run: | | |
echo "Commit message: ${{ github.event.head_commit.message }}" | |
if echo "${{ github.event.head_commit.message }}" | grep -q "\[skip version\]"; then | |
echo "type=skip" >> $GITHUB_OUTPUT # Skip version bump | |
elif echo "${{ github.event.head_commit.message }}" | grep -q "MAJOR:"; then | |
echo "type=major" >> $GITHUB_OUTPUT # Major version bump | |
elif echo "${{ github.event.head_commit.message }}" | grep -q "MINOR:"; then | |
echo "type=minor" >> $GITHUB_OUTPUT # Minor version bump | |
else | |
echo "type=patch" >> $GITHUB_OUTPUT # Patch version bump | |
fi | |
# This step analyzes the commit message to determine the type of version bump | |
- name: Version Bump and Push | |
if: steps.version-bump-type.outputs.type != 'skip' | |
run: | | |
bump2version ${{ steps.version-bump-type.outputs.type }} --config-file .bumpversion.cfg | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git push | |
git push --tags | |
# This step performs the version bump and pushes the changes to the repository | |
- name: Install Python packaging tools | |
run: | | |
pip install --upgrade pip setuptools wheel | |
- name: Install project dependencies | |
run: pip install -r requirements.txt | |
- name: Build and publish | |
if: steps.version-bump-type.outputs.type != 'skip' | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
# This step builds and publishes the package if a version bump is required |