Skip to content

Commit

Permalink
build: correct version even if unannotated tag (#1792)
Browse files Browse the repository at this point in the history
* build: correct version even if unannotated tag

* CI: force correct git describe
  • Loading branch information
casperdcl authored Apr 25, 2024
1 parent e51e2ab commit ae94a9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ jobs:
numpy-version: [1.25]
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
with:
fetch-depth: 0
submodules: recursive
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -130,7 +133,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0, submodules: recursive}
with:
fetch-depth: 0
submodules: recursive
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
- uses: conda-incubator/setup-miniconda@v3
with: {python-version: 3.11}
- name: install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Wrappers/Python/CMake/parse_git_describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
git_executable = os.path.abspath(sys.argv[1])

pattern = re.compile('v([0-9]*)\.([0-9]*)(\.*)([0-9]*)')
git_describe_string = subprocess.check_output(f'"{git_executable}" describe', shell=True).decode("utf-8").rstrip()
git_describe_string = subprocess.check_output(f'"{git_executable}" describe --tags', shell=True).decode("utf-8").rstrip()
v = git_describe_string.split('-')
if len(v) == 3:
git_version_string, git_commit_number, git_hash = git_describe_string.split('-')
Expand Down

0 comments on commit ae94a9c

Please sign in to comment.