Skip to content
Open
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
84 changes: 84 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Bump Version
on:
workflow_dispatch:
inputs:
version_part:
description: 'Version part to bump (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch

jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install bumpversion
run: |
python -m pip install --upgrade pip
pip install bump2version

- name: Configure git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Get current version
id: current_version
run: |
echo "version=$(grep current_version .bumpversion.cfg | cut -d '=' -f 2 | tr -d ' ')" >> $GITHUB_OUTPUT

- name: Bump version
id: bump_version
run: |
# Use --no-tag to prevent creating a tag (we'll tag after PR merge)
# Use --no-commit to let create-pull-request handle the commit
bump2version ${{ github.event.inputs.version_part }} --no-tag --no-commit
echo "new_version=$(grep current_version .bumpversion.cfg | cut -d '=' -f 2 | tr -d ' ')" >> $GITHUB_OUTPUT

- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@v5

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Bump Version' step
Uses Step: create_pr
uses 'peter-evans/create-pull-request' with ref 'v5', not a pinned commit hash
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: bump version from ${{ steps.current_version.outputs.version }} to ${{ steps.bump_version.outputs.new_version }}"
title: "chore: bump version from ${{ steps.current_version.outputs.version }} to ${{ steps.bump_version.outputs.new_version }}"
body: |
## Version Bump

This PR bumps the version from `${{ steps.current_version.outputs.version }}` to `${{ steps.bump_version.outputs.new_version }}`.

### Changes
- Updated version in `setup.py`
- Updated version in `docs/conf.py`
- Updated version in `src/datapilot/__init__.py`
- Updated version in `.bumpversion.cfg`

### Type of change
- Version bump (${{ github.event.inputs.version_part }})

---
*This PR was automatically created by the bump version workflow.*
branch: bump-version-${{ steps.bump_version.outputs.new_version }}
delete-branch: true
labels: |
version-bump
automated
49 changes: 49 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tag Release
on:
pull_request:
types: [closed]
branches: [main]

jobs:
tag-release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox twine wheel setuptools

- name: Get version from file
id: get_version
run: |
echo "version=$(grep current_version .bumpversion.cfg | cut -d '=' -f 2 | tr -d ' ')" >> $GITHUB_OUTPUT

- name: Create and push tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release version ${{ steps.get_version.outputs.version }}"
git push origin "v${{ steps.get_version.outputs.version }}"

- name: Make release script executable
run: chmod +x release.sh

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: ./release.sh