1- name : Version Bump
2- run-name : Version bump ${{ github.event_name == 'workflow_dispatch' && inputs.bump_type || 'patch' }}${{ github.event_name == 'workflow_dispatch' && inputs.test_mode && ' (TEST)' || '' }}
1+ name : Version Bump and Release
2+ run-name : Version bump and release ${{ github.event_name == 'workflow_dispatch' && inputs.bump_type || 'patch' }}${{ github.event_name == 'workflow_dispatch' && inputs.test_mode && ' (TEST)' || '' }}
33
44on :
55 workflow_dispatch :
@@ -74,16 +74,17 @@ jobs:
7474
7575 if [[ "${{ env.TEST_MODE }}" == "true" ]]; then
7676 TIMESTAMP=$(date +%Y%m%d%H%M%S)
77- TEST_VERSION="${BASE_VERSION}-test.${TIMESTAMP}"
77+
78+ TAG_PREFIX="test-"
79+ NEW_VERSION="${BASE_VERSION}.${TIMESTAMP}"
80+ TEST_VERSION="${TAG_PREFIX}${NEW_VERSION}"
7881 echo "Adding test suffix"
7982 # Update version in pyproject.toml and in __init__.py
8083 awk -v new_version="$TEST_VERSION" '/^version = / {$0 = "version = \"" new_version "\""} 1' pyproject.toml > pyproject.tmp && mv pyproject.tmp pyproject.toml
8184 awk -v new_version="$TEST_VERSION" '/^__version__ = / {$0 = "__version__ = \"" new_version "\""} 1' darwin/__init__.py > darwin/__init__.tmp && mv darwin/__init__.tmp darwin/__init__.py
8285
83- NEW_VERSION="${BASE_VERSION}-test.${TIMESTAMP}"
84- echo $NEW_VERSION
85- TAG_PREFIX="test-"
86- BRANCH_NAME="test/version-bump-${NEW_VERSION}"
86+
87+ BRANCH_NAME="${TAG_PREFIX}-branch-${NEW_VERSION}"
8788 else
8889 NEW_VERSION="${BASE_VERSION}"
8990 TAG_PREFIX="v"
@@ -105,7 +106,7 @@ jobs:
105106 run : |
106107 echo "Commit and push version changes"
107108 git add pyproject.toml darwin/__init__.py
108- git commit -m "Version bump to ${{ env.NEW_VERSION }}"
109+ git commit -m "Version bump to ${{ env.TAG_PREFIX}}${{ env. NEW_VERSION }}"
109110 git push origin HEAD:${BRANCH_NAME}
110111 env :
111112 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -125,3 +126,13 @@ jobs:
125126 git push origin "${TAG_PREFIX}${NEW_VERSION}"
126127 env :
127128 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
129+
130+ - name : Create release
131+ uses : actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
132+ env :
133+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134+ with :
135+ tag_name : ${{ env.TAG_PREFIX}}${{ env.NEW_VERSION }}
136+ release_name : ${{ env.TAG_PREFIX}}${{ env.NEW_VERSION }}
137+ draft : true
138+ prerelease : false
0 commit comments