Skip to content

Commit 90d3574

Browse files
committed
Workaround GitHub's broken annotated tag handing.
Update action/checkout versions.
1 parent 79c8e38 commit 90d3574

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

.github/workflows/python-package.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ defaults:
1111
run:
1212
shell: bash
1313

14+
env:
15+
git-depth: 0 # Depth to search for tags.
16+
1417
jobs:
1518
black:
1619
runs-on: ubuntu-20.04
1720
steps:
18-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
1922
- name: Install Black
2023
run: pip install black
2124
- name: Run Black
@@ -24,7 +27,7 @@ jobs:
2427
isort:
2528
runs-on: ubuntu-20.04
2629
steps:
27-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
2831
- name: Install isort
2932
run: pip install isort
3033
- name: isort
@@ -41,7 +44,7 @@ jobs:
4144
flake8:
4245
runs-on: ubuntu-20.04
4346
steps:
44-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v3
4548
- name: Install Flake8
4649
run: pip install Flake8
4750
- name: Flake8
@@ -53,7 +56,7 @@ jobs:
5356
mypy:
5457
runs-on: ubuntu-20.04
5558
steps:
56-
- uses: actions/checkout@v2
59+
- uses: actions/checkout@v3
5760
- name: Checkout submodules
5861
run: git submodule update --init --recursive --depth 1
5962
- name: Install Python dependencies
@@ -76,7 +79,9 @@ jobs:
7679
sdl-version: ["2.0.14", "2.0.16"]
7780
fail-fast: true
7881
steps:
79-
- uses: actions/checkout@v1 # v1 required to build package.
82+
- uses: actions/checkout@v3
83+
with:
84+
fetch-depth: ${{ env.git-depth }}
8085
- name: Checkout submodules
8186
run: git submodule update --init --recursive --depth 1
8287
- name: Build package
@@ -101,9 +106,9 @@ jobs:
101106
fail-fast: false
102107

103108
steps:
104-
# v2 breaks `git describe` so v1 is needed.
105-
# https://github.com/actions/checkout/issues/272
106-
- uses: actions/checkout@v1
109+
- uses: actions/checkout@v3
110+
with:
111+
fetch-depth: ${{ env.git-depth }}
107112
- name: Checkout submodules
108113
run: |
109114
git submodule update --init --recursive --depth 1
@@ -197,7 +202,9 @@ jobs:
197202
arch: ["x86_64", "aarch64"]
198203
build: ["cp37-manylinux*", "pp37-manylinux*"]
199204
steps:
200-
- uses: actions/checkout@v1
205+
- uses: actions/checkout@v3
206+
with:
207+
fetch-depth: ${{ env.git-depth }}
201208
- name: Set up QEMU
202209
if: ${{ matrix.arch == 'aarch64' }}
203210
uses: docker/setup-qemu-action@v1
@@ -248,13 +255,15 @@ jobs:
248255
matrix:
249256
python: ["cp38-*_universal2", "cp38-*_x86_64", "cp38-*_arm64", "pp37-*"]
250257
steps:
251-
# v2 breaks `git describe` so v1 is needed.
252-
# https://github.com/actions/checkout/issues/272
253-
- uses: actions/checkout@v1
258+
- uses: actions/checkout@v3
259+
with:
260+
fetch-depth: ${{ env.git-depth }}
254261
- name: Checkout submodules
255262
run: git submodule update --init --recursive --depth 1
256263
- name: Print git describe
257-
run: git describe
264+
# "--tags" is required to workaround actions/checkout's broken annotated tag handing.
265+
# https://github.com/actions/checkout/issues/290
266+
run: git describe --tags
258267
- name: Install Python dependencies
259268
run: pip3 install wheel twine -r requirements.txt
260269
- name: Prepare package

.github/workflows/release-on-tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1515
- name: Generate body
1616
run: |
1717
scripts/get_release_description.py | tee release_body.md

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
def get_version() -> str:
2020
"""Get the current version from a git tag, or by reading tcod/version.py"""
2121
if (SETUP_DIR / ".git").exists():
22-
tag = subprocess.check_output(["git", "describe", "--abbrev=0"], universal_newlines=True).strip()
22+
# "--tags" is required to workaround actions/checkout's broken annotated tag handing.
23+
# https://github.com/actions/checkout/issues/290
24+
tag = subprocess.check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip()
2325
assert not tag.startswith("v")
2426
version = tag
2527

0 commit comments

Comments
 (0)