|
| 1 | +name: Bump Version |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version_part: |
| 6 | + description: 'Version part to bump (major, minor, patch)' |
| 7 | + required: true |
| 8 | + default: 'patch' |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - major |
| 12 | + - minor |
| 13 | + - patch |
| 14 | + |
| 15 | +jobs: |
| 16 | + bump-version: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: write |
| 20 | + pull-requests: write |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + |
| 29 | + - name: Set up Python |
| 30 | + uses: actions/setup-python@v5 |
| 31 | + with: |
| 32 | + python-version: '3.11' |
| 33 | + |
| 34 | + - name: Install bumpversion |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + pip install bump2version |
| 38 | +
|
| 39 | + - name: Configure git |
| 40 | + run: | |
| 41 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 42 | + git config --local user.name "github-actions[bot]" |
| 43 | +
|
| 44 | + - name: Get current version |
| 45 | + id: current_version |
| 46 | + run: | |
| 47 | + version=$(grep '^current_version' .bumpversion.cfg | cut -d '=' -f 2 | tr -d ' ') |
| 48 | + echo "version=${version}" >> "$GITHUB_OUTPUT" |
| 49 | +
|
| 50 | + - name: Bump version |
| 51 | + id: bump_version |
| 52 | + run: | |
| 53 | + # Use --no-tag to prevent creating a tag (we'll tag after PR merge) |
| 54 | + # Use --no-commit to let create-pull-request handle the commit |
| 55 | + bump2version ${{ github.event.inputs.version_part }} --no-tag --no-commit |
| 56 | + new_version=$(grep '^current_version' .bumpversion.cfg | cut -d '=' -f 2 | tr -d ' ') |
| 57 | + echo "new_version=${new_version}" >> "$GITHUB_OUTPUT" |
| 58 | +
|
| 59 | + - name: Create Pull Request |
| 60 | + id: create_pr |
| 61 | + uses: peter-evans/create-pull-request@v5 |
| 62 | + with: |
| 63 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + commit-message: "chore: bump version from ${{ steps.current_version.outputs.version }} to ${{ steps.bump_version.outputs.new_version }}" |
| 65 | + title: "chore: bump version from ${{ steps.current_version.outputs.version }} to ${{ steps.bump_version.outputs.new_version }}" |
| 66 | + body: | |
| 67 | + ## Version Bump |
| 68 | +
|
| 69 | + This PR bumps the version from `${{ steps.current_version.outputs.version }}` to `${{ steps.bump_version.outputs.new_version }}`. |
| 70 | +
|
| 71 | + ### Changes |
| 72 | + - Updated version in `setup.py` |
| 73 | + - Updated version in `docs/conf.py` |
| 74 | + - Updated version in `src/datapilot/__init__.py` |
| 75 | + - Updated version in `.bumpversion.cfg` |
| 76 | +
|
| 77 | + ### Type of change |
| 78 | + - Version bump (${{ github.event.inputs.version_part }}) |
| 79 | +
|
| 80 | + --- |
| 81 | + *This PR was automatically created by the bump version workflow.* |
| 82 | + branch: bump-version-${{ steps.bump_version.outputs.new_version }} |
| 83 | + delete-branch: true |
| 84 | + labels: | |
| 85 | + version-bump |
| 86 | + automated |
0 commit comments