Skip to content

Commit

Permalink
Try to use GitHub releases to sync deployment of MacOS.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HexDecimal committed Dec 4, 2020
1 parent db1c5d4 commit b46bd07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/python-package-macos.yml
@@ -1,6 +1,11 @@
name: Python package (MacOS)

on: [push, pull_request]
on:
push:
pull_request:
release:
types:
- created

jobs:
build:
Expand All @@ -18,6 +23,9 @@ jobs:
- name: Checkout submodules
run: |
git submodule update --init --recursive --depth 1
- name: Print git describe
run: |
git describe
- name: Set up Mac Python ${{ matrix.python-version }}
# actions/setup-python can't be used as it builds less portable extensions.
env:
Expand All @@ -37,6 +45,8 @@ jobs:
python -m pip install pytest pytest-cov pytest-benchmark delocate wheel twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build package.
env:
TCOD_TAG: ${{ github.event.release.tag_name }}
run: |
python setup.py sdist develop bdist_wheel --py-limited-api=cp35
- name: Package binary files
Expand All @@ -48,7 +58,7 @@ jobs:
pytest --no-window --cov-report=xml
- uses: codecov/codecov-action@v1
- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/') # Only run on tags.
if: github.event_name == 'release'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
4 changes: 3 additions & 1 deletion setup.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import sys
import os.path
import os

from setuptools import setup

Expand All @@ -14,6 +14,8 @@

def get_version():
"""Get the current version from a git tag, or by reading tcod/version.py"""
if os.environ.get("TCOD_TAG"):
return os.environ["TCOD_TAG"]
try:
tag = check_output(
["git", "describe", "--abbrev=0"], universal_newlines=True
Expand Down

0 comments on commit b46bd07

Please sign in to comment.