Skip to content
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
21 changes: 21 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.bumpversion]
current_version = "2.5.1"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "{current_version} → {new_version}"
allow_dirty = false
commit = true
message = "{current_version} → {new_version}"
moveable_tags = []
commit_args = ""
setup_hooks = []
pre_commit_hooks = []
post_commit_hooks = []
99 changes: 57 additions & 42 deletions .github/workflows/bump-version-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,80 @@
---
# yamllint disable rule:line-length
name: Bump_and_Package

on: # yamllint disable-line rule:truthy
on:
push:
branches:
- master

jobs:
bump-version:

runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, '[SKIP]')"

steps:
permissions:
contents: write
pull-requests: write

- uses: actions/checkout@v1
outputs:
skip-bump: ${{ steps.determine-bump.outputs.skip-bump }}

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

- name: Setup Git
steps:
- name: Determine bump type
id: determine-bump
run: |
git config user.name "JoaoRodrigues"
git config user.email '[email protected]'
git remote set-url origin \https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout "${GITHUB_REF:11}"
COMMIT_MSG="${{ github.event.head_commit.message }}"
echo "PR title: $COMMIT_MSG"
if [[ "$COMMIT_MSG" =~ ^\[MAJOR\] ]]; then
echo "bump-type=major" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[MINOR\] ]]; then
echo "bump-type=minor" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[PATCH\] ]]; then
echo "bump-type=patch" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[SKIP\] ]]; then
echo "skip-bump=true" >> $GITHUB_OUTPUT
echo "::notice::Version bump skipped based on PR title"
exit 0
else
echo "::error::PR title must start with [MAJOR], [MINOR], [PATCH], or [SKIP]"
exit 1
fi

- name: Create skip flag
run: |
echo "SKIPBUMP=FALSE" >> $GITHUB_ENV
- name: Bump version
if: steps.determine-bump.outputs.skip-bump != 'true'
id: bump
uses: callowayproject/bump-my-version@master
with:
args: ${{ steps.determine-bump.outputs.bump-type }} setup.py -v
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version setuptools wheel twine
publish:
if: needs.bump-version.outputs.skip-bump != 'true'
name: builds and publishes to pypi
needs: [bump-version]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pdb-tools

- name: Bump Minor Version
run: |
bump2version minor
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV
if: "startsWith(github.event.head_commit.message, '[FEATURE]')"
permissions:
id-token: write

# Default action
- name: Bump Patch Version
run: |
bump2version patch
if: env.SKIPBUMP == 'FALSE'
steps:
- uses: actions/checkout@v4

# No major version change should go through automatically.
- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Commit version change to master
- name: install dependencies
run: |
git push --follow-tags
python -m pip install --upgrade pip
python -m pip install --upgrade build
python -m pip install setuptools wheel twine

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: build
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
pyhton setup.py sdist bdist_wheel

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,43 @@ name: ci

on:
pull_request:
types: [opened, edited, synchronize]
branches:
- master
push:
branches:
- master

jobs:
bump:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Determine bump type from PR title
id: determine-bump
run: |
COMMIT_MSG=$(printf "%s" "${{ github.event.pull_request.title }}")
echo "PR title: $COMMIT_MSG"
if [[ "$COMMIT_MSG" =~ ^\[MAJOR\] ]]; then
echo "bump-type=major" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[MINOR\] ]]; then
echo "bump-type=minor" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[PATCH\] ]]; then
echo "bump-type=patch" >> $GITHUB_OUTPUT
elif [[ "$COMMIT_MSG" =~ ^\[SKIP\] ]]; then
echo "skip-bump=true" >> $GITHUB_OUTPUT
echo "::notice::Version bump skipped based on PR title"
exit 0
else
echo "::error::PR title must start with [MAJOR], [MINOR], [PATCH], or [SKIP]"
exit 1
fi

linter:
runs-on: ubuntu-latest
needs: [bump]

steps:
- uses: actions/checkout@v4
Expand All @@ -32,6 +60,7 @@ jobs:

test:
name: test
needs: [bump]
runs-on: ${{ matrix.platform }}
strategy:
matrix:
Expand All @@ -49,7 +78,7 @@ jobs:
- name: install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade bump2version twine
python -m pip install --upgrade twine
python -m pip install --upgrade coverage

- name: build
Expand All @@ -58,9 +87,6 @@ jobs:
python setup.py sdist bdist_wheel
twine check dist/*.whl
twine check dist/*.tar.gz
bump2version --dry-run --verbose --allow-dirty patch
bump2version --dry-run --verbose --allow-dirty minor
bump2version --dry-run --verbose --allow-dirty major

- name: install pdb-tools
run: |
Expand Down
Loading