Skip to content

Commit 41f9241

Browse files
committed
🧪 Force local_scheme @ CI on merge
1 parent a2c19be commit 41f9241

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

.github/workflows/ci-cd.yml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -450,24 +450,63 @@ jobs:
450450
--skip-missing-interpreters false
451451
--notest
452452
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+
453462
- name: Setup git user as [bot]
454463
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)
457466
uses: fregante/setup-git-user@v2
458467
- name: >-
459468
Tag the release in the local Git repo
460469
as ${{ needs.pre-setup.outputs.git-tag }}
461470
for setuptools-scm to set the desired version
462471
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)
465473
run: >-
466474
git tag
467475
-m '${{ needs.pre-setup.outputs.git-tag }}'
468476
'${{ needs.pre-setup.outputs.git-tag }}'
469477
--
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
471510
472511
- name: Build dists
473512
run: >-

0 commit comments

Comments
 (0)