Skip to content

Commit 1677c5f

Browse files
committed
Clone repository manually to fix git describe.
Remove TCOD_TAG hack.
1 parent 19ddcd3 commit 1677c5f

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

.github/workflows/python-package-macos.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ jobs:
1616
python-version: ['3.7.9']
1717

1818
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
fetch-depth: 0 # Needed for git describe to find tags.
19+
- name: Clone ${{github.repository}}
20+
# actions/checkout breaks `git describe` so a manual clone is needed.
21+
# https://github.com/actions/checkout/issues/272
22+
run: |
23+
git clone https://github.com/${{github.repository}}.git ${{github.workspace}}
24+
git checkout ${{github.sha}}
2225
- name: Checkout submodules
2326
run: |
2427
git submodule update --init --recursive --depth 1
@@ -45,8 +48,6 @@ jobs:
4548
python -m pip install git+https://github.com/HexDecimal/delocate.git@loader_path
4649
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4750
- name: Build package.
48-
env:
49-
TCOD_TAG: ${{ github.event.release.tag_name }}
5051
run: |
5152
python setup.py sdist develop bdist_wheel --py-limited-api=cp36
5253
- name: Test with pytest

.github/workflows/python-package.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ jobs:
1515
fail-fast: false
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0 # Needed for git describe to find tags.
18+
- name: Clone ${{github.repository}}
19+
# actions/checkout breaks `git describe` so a manual clone is needed.
20+
# https://github.com/actions/checkout/issues/272
21+
run: |
22+
git clone https://github.com/${{github.repository}}.git ${{github.workspace}}
23+
git checkout ${{github.sha}}
2124
- name: Checkout submodules
2225
run: |
2326
git submodule update --init --recursive --depth 1

setup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
def get_version():
1616
"""Get the current version from a git tag, or by reading tcod/version.py"""
17-
if os.environ.get("TCOD_TAG"):
18-
# Force a tag version from an environment variable.
19-
# Needed to work with GitHub Actions.
20-
with open("tcod/version.py", "w") as f:
21-
f.write('__version__ = "%s"\n' % os.environ["TCOD_TAG"])
22-
return os.environ["TCOD_TAG"]
2317
try:
2418
tag = check_output(
2519
["git", "describe", "--abbrev=0"], universal_newlines=True

0 commit comments

Comments
 (0)