@@ -31,44 +31,39 @@ jobs:
3131 # https://github.com/cmu-delphi/delphi-epidata/pull/1473
3232 run : |
3333 python -m pip install bump2version
34- allowed_pattern="^(major|minor|patch|[0-9]+\.[0-9]+\.[0-9]+)$"
35-
36- if [[ ! ${{ github.event.inputs.versionName }} =~ $allowed_pattern ]]; then
37- echo "\nInvalid version name: ${{ github.event.inputs.versionName }}"
38- exit 1
39- fi
40-
4134 if [[ ${{ github.event.inputs.versionName }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4235 # use given version number
4336 NEXT_TAG="${{ github.event.inputs.versionName }}"
44- else
37+ elif [[ ${{ github.event.inputs.versionName }} =~ ^(major|minor|patch)$ ]]; then
4538 # calculate new version number based on given tag
4639 NEXT_TAG=$(bump2version --dry-run --list ${{ github.event.inputs.versionName }} | grep ^new_version | sed -r s,"^.*=",,)
40+ else
41+ echo "\nInvalid version name: ${{ github.event.inputs.versionName }}"
42+ exit 1
4743 fi
4844 # apply given or calculated version number
4945 bump2version --new-version $NEXT_TAG _ignored_arg_
5046 # save version number for later
5147 echo "next_tag=$NEXT_TAG" >> $GITHUB_OUTPUT
52- - name : Get main branch SHA
53- id : base-sha
54- run : echo "sha=$(git rev-parse origin/main)" >> $GITHUB_OUTPUT
5548 - name : Get Python client file changes
5649 id : changed-py
5750 uses : dorny/paths-filter@v3
5851 with :
59- base : " ${{ steps.base-sha.outputs.sha }}"
52+ base : " main"
53+ ref : " dev"
6054 filters : |
6155 python_client_changed:
62- - src/client/delphi_epidata.py
63- - src/client/packaging/pypi/**
56+ - src/client/delphi_epidata.py
57+ - src/client/packaging/pypi/**
6458 - name : Bump Python versions if client files changed
6559 if : steps.changed-py.outputs.python_client_changed == 'true'
6660 # _ignored_arg_ below is required because of tool quirk
6761 # https://github.com/c4urself/bump2version/issues/22
6862 run : |
6963 cd src/client/packaging/pypi
64+ # this is using the new literal version number (steps.version.outputs.next_tag) output from the bump2version step above, not the workflow input (github.event.inputs.versionName) which can be relative
7065 bump2version --allow-dirty --new-version ${{ steps.version.outputs.next_tag }} _ignored_arg_
71- - name : Create pull request into prod
66+ - name : Create pull request into main
7267 uses : peter-evans/create-pull-request@v3
7368 with :
7469 branch : release/delphi-epidata-${{ steps.version.outputs.next_tag }}
0 commit comments