From 3775119f83535ef2a26ecdff59f7577c3a1544a5 Mon Sep 17 00:00:00 2001 From: Dave Keeshan <96727608+davekeeshan@users.noreply.github.com> Date: Sun, 18 Dec 2022 19:30:27 +0000 Subject: [PATCH] Clean PyPi release flow 17/12/2022 (#399) * Move conditional so the whole job doesn't run unless it is a tag * Add dist to make and restructure release * Add message * Add message * Add message * Add message * Add message * Add message * Add message * Add message * Add message * Add README to release to appear on PyPi * Added read definition --- .github/workflows/test_checkin.yml | 4 ++-- Makefile | 14 ++++++++++++-- setup.py | 7 ++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_checkin.yml b/.github/workflows/test_checkin.yml index cc84c5de..5201122f 100644 --- a/.github/workflows/test_checkin.yml +++ b/.github/workflows/test_checkin.yml @@ -81,14 +81,14 @@ jobs: make ${CI_TARGET} pypy_release: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') runs-on: ubuntu-latest needs: [build_code] steps: - uses: actions/checkout@v3 - name: Make PyPi dist release - run: make release + run: make dist - name: Publish Python distribution to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/Makefile b/Makefile index 059947bb..2bc5703b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ PYTEST_OPTS ?= +TAG ?=`grep __version__ myhdl/__init__.py | grep -oe '\([0-9.]*\)'` +MSG ?= "Release "${TAG} +VERSION_FILE := myhdl/__init__.py ANSI_RED=`tput setaf 1` ANSI_GREEN=`tput setaf 2` ANSI_CYAN=`tput setaf 6` @@ -16,11 +19,18 @@ docs: livedocs: tox -e docs livehtml -release: +dist: rm -rf MANIFEST rm -rf CHANGELOG.txt #hg glog > CHANGELOG.txt - python setup.py sdist + python setup.py sdist + +release: + @echo "Preparing ${TAG} - Message - ${MSG}" + @sed -i "s|__version__ = \"[0-9.]\+\"|__version__ = \"${TAG}\"|g" ${VERSION_FILE} + git commit --allow-empty -m ${MSG} ${VERSION_FILE} + git tag -a ${TAG} -m ${MSG} + git push && git push --tags clean: rm -rf *.vhd *.v *.o *.log *.hex work/ cosimulation/icarus/myhdl.vpi diff --git a/setup.py b/setup.py index 538f11df..a3338e2e 100644 --- a/setup.py +++ b/setup.py @@ -33,11 +33,16 @@ for base, dir, files in os.walk('cosimulation'): if good: cosim_data[base].extend(os.path.join(base, f) for f in good) +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + + setup( name="myhdl", version=version, description="Python as a Hardware Description Language", - long_description="See home page.", + long_description=read('README.md'), + long_description_content_type='text/markdown', author="Jan Decaluwe", author_email="jan@jandecaluwe.com", url="http://www.myhdl.org",