Skip to content

Commit b46bd07

Browse files
committed
Try to use GitHub releases to sync deployment of MacOS.
The previous tag method has failed since it didn't use the existing tag but the previous one. I need to look into this more.
1 parent db1c5d4 commit b46bd07

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Python package (MacOS)
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types:
8+
- created
49

510
jobs:
611
build:
@@ -18,6 +23,9 @@ jobs:
1823
- name: Checkout submodules
1924
run: |
2025
git submodule update --init --recursive --depth 1
26+
- name: Print git describe
27+
run: |
28+
git describe
2129
- name: Set up Mac Python ${{ matrix.python-version }}
2230
# actions/setup-python can't be used as it builds less portable extensions.
2331
env:
@@ -37,6 +45,8 @@ jobs:
3745
python -m pip install pytest pytest-cov pytest-benchmark delocate wheel twine
3846
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3947
- name: Build package.
48+
env:
49+
TCOD_TAG: ${{ github.event.release.tag_name }}
4050
run: |
4151
python setup.py sdist develop bdist_wheel --py-limited-api=cp35
4252
- name: Package binary files
@@ -48,7 +58,7 @@ jobs:
4858
pytest --no-window --cov-report=xml
4959
- uses: codecov/codecov-action@v1
5060
- name: Upload to PyPI
51-
if: startsWith(github.ref, 'refs/tags/') # Only run on tags.
61+
if: github.event_name == 'release'
5262
env:
5363
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
5464
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
import sys
4-
import os.path
4+
import os
55

66
from setuptools import setup
77

@@ -14,6 +14,8 @@
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+
return os.environ["TCOD_TAG"]
1719
try:
1820
tag = check_output(
1921
["git", "describe", "--abbrev=0"], universal_newlines=True

0 commit comments

Comments
 (0)