Skip to content

Commit

Permalink
Merge pull request #50 from blackrock/fix/python-publish
Browse files Browse the repository at this point in the history
[FEATURE] Update python-publish.yml to auto increment version when tag is intro…
  • Loading branch information
swarnadhakad authored Sep 8, 2024
2 parents 893634b + 8f10052 commit 65e4b16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Upload Python 🐍 distibution to PyPI 📦

on:
push:
branches: [main]
tags:
- '*'

permissions:
contents: read
contents: write

jobs:
deploy:
Expand All @@ -30,9 +31,19 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install build
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Update version in setup.py
run: >-
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
- name: Build package
run: python -m build
- name: Publish package

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
PKG_NAME = 'ingen-lib'
MAIN_PKG = 'ingen'
VERSION_PY_FILE = os.path.join(MAIN_PKG, 'version.py')
DEFAULT_PKG_VERSION = '1.0.0'
PKG_VERSION = DEFAULT_PKG_VERSION
PKG_VERSION_FILE = 'pkg_version.txt'

setup(name=PKG_NAME,
version=PKG_VERSION,
version='{{VERSION_PLACEHOLDER}}',
packages=setuptools.find_packages(include=['ingen', 'ingen.*']),
package_data={},
description='A Python script suite that generates interface files based on the given interface metadata/config '
Expand Down

0 comments on commit 65e4b16

Please sign in to comment.