@@ -450,24 +450,63 @@ jobs:
450
450
--skip-missing-interpreters false
451
451
--notest
452
452
453
+ - name : Drop Git tags from HEAD for non-tag-create events
454
+ if : >-
455
+ !fromJSON(needs.pre-setup.outputs.release-requested)
456
+ run : >-
457
+ git tag --points-at HEAD
458
+ |
459
+ xargs git tag --delete
460
+ shell : bash
461
+
453
462
- name : Setup git user as [bot]
454
463
if : >-
455
- fromJSON(needs.pre-setup.outputs.is-untagged-devel )
456
- || fromJSON(needs.pre-setup.outputs.release-requested )
464
+ fromJSON(needs.pre-setup.outputs.release-requested )
465
+ || fromJSON(needs.pre-setup.outputs.is-untagged-devel )
457
466
uses : fregante/setup-git-user@v2
458
467
- name : >-
459
468
Tag the release in the local Git repo
460
469
as ${{ needs.pre-setup.outputs.git-tag }}
461
470
for setuptools-scm to set the desired version
462
471
if: >-
463
- fromJSON(needs.pre-setup.outputs.is-untagged-devel)
464
- || fromJSON(needs.pre-setup.outputs.release-requested)
472
+ fromJSON(needs.pre-setup.outputs.release-requested)
465
473
run: >-
466
474
git tag
467
475
-m '${{ needs.pre-setup.outputs.git-tag }}'
468
476
'${{ needs.pre-setup.outputs.git-tag }}'
469
477
--
470
- ${{ github.event.inputs.release-committish }}
478
+ ${{
479
+ fromJSON(needs.pre-setup.outputs.release-requested)
480
+ && github.event.inputs.release-committish || ''
481
+ }}
482
+
483
+ - name : Install tomlkit Python distribution package
484
+ if : >-
485
+ fromJSON(needs.pre-setup.outputs.is-untagged-devel)
486
+ run : >-
487
+ python -m pip install --user tomlkit
488
+ - name : Instruct setuptools-scm not to add a local version part
489
+ if : >-
490
+ fromJSON(needs.pre-setup.outputs.is-untagged-devel)
491
+ run : |
492
+ from pathlib import Path
493
+
494
+ import tomlkit
495
+
496
+ pyproject_toml_path = Path.cwd() / 'pyproject.toml'
497
+ pyproject_toml_txt = pyproject_toml_path.read_text()
498
+ pyproject_toml = tomlkit.loads(pyproject_toml_txt)
499
+ setuptools_scm_section = pyproject_toml['tool']['setuptools_scm']
500
+ setuptools_scm_section['local_scheme'] = 'no-local-version'
501
+ patched_pyproject_toml_txt = tomlkit.dumps(pyproject_toml)
502
+ pyproject_toml_path.write_text(patched_pyproject_toml_txt)
503
+ shell : python
504
+ - name : Pretend that pyproject.toml is unchanged
505
+ if : >-
506
+ fromJSON(needs.pre-setup.outputs.is-untagged-devel)
507
+ run : |
508
+ git diff --color=always
509
+ git update-index --assume-unchanged pyproject.toml
471
510
472
511
- name : Build dists
473
512
run : >-
0 commit comments