File tree Expand file tree Collapse file tree 3 files changed +69
-6
lines changed Expand file tree Collapse file tree 3 files changed +69
-6
lines changed Original file line number Diff line number Diff line change 1+ name : Bump version
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ bump-patch :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v4
11+ - name : Install Node.js
12+ uses : actions/setup-node@v4
13+ with :
14+ node-version : 20
15+ - name : Exit if branch exists
16+ run : |
17+ BRANCH_NAME="update-version"
18+ if git ls-remote --heads origin $BRANCH_NAME | grep -q $BRANCH_NAME; then
19+ echo "Branch $BRANCH_NAME already exists."
20+ exit 1
21+ fi
22+ - name : Create a new branch
23+ run : |
24+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
25+ git config --global user.name "github-actions[bot]"
26+ git checkout -b update-version
27+ git push --set-upstream origin update-version
28+ - name : Bump Version
29+ run : |
30+ ./util/bump-version.sh
31+ git commit -am "Bump version for next release"
32+ git push
33+ - name : create pull request
34+ run : >
35+ gh pr create
36+ -B main
37+ -H update-version
38+ --title 'Bump version for next release'
39+ --body 'Bump the version in prep for next release'
40+ env :
41+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -46,16 +46,16 @@ Making a Release
4646#. Click “Draft a new release” button on top of screen
4747#. For the tag, make a new tag with the new version number
4848#. You can generate the release notes via the “generate release notes” button,
49- comparing against the most recent release. This will autofill in the details
49+ comparing against the most recent release. This will autofill in the details
5050 for you
51- #. Click “ Publish release”
51+ #. Click " Publish release"
5252 - This will trigger the workflow to push a new release to PyPI, assuming no
5353 problems have snuck into our release procedure since the last time it was
5454 run
55- #. Open a PR bumping the version to the next version number so that we’ re ready
56- for the next change. This should always be the first PR in a new release
57- (otherwise we’ ll have build issues), so it should be straight-forward to
58- figure out how to do this
55+ #. Open a PR bumping the version to the next version number so that we' re ready
56+ for the next change. This should always be the first PR in a new release
57+ (otherwise we' ll have build issues). This can be done by running the
58+ 'bump-version' GitHub Action, which will create the PR for you.
5959
6060In case of issues, the release pushing job is in
6161.github/workflows/python-publish.yml
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ SCRIPT_DIR=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
6+
7+ version_file=" $SCRIPT_DIR /../sphinxcontrib/chapeldomain/__init__.py"
8+ current_version=$( grep -E " VERSION\s*=\s*'[0-9.]+" " $version_file " | awk -F" =" ' {print $2}' | tr -d ' ' | tr -d " '" )
9+ echo " Current version: $current_version "
10+ major_version=$( echo " $current_version " | awk -F" ." ' {print $1}' )
11+ minor_version=$( echo " $current_version " | awk -F" ." ' {print $2}' )
12+ patch_version=$( echo " $current_version " | awk -F" ." ' {print $3}' )
13+
14+
15+ new_patch_version=$(( patch_version + 1 ))
16+ new_version=" ${major_version} .${minor_version} .${new_patch_version} "
17+ echo " New version: $new_version "
18+
19+ # update the version file
20+ set -x
21+ sed -E " s|^(VERSION[[:space:]]*=[[:space:]]*)'[^']+'$|\1'${new_version} '|" " $version_file " > " ${version_file} .tmp"
22+ mv " ${version_file} .tmp" " $version_file "
You can’t perform that action at this time.
0 commit comments