Skip to content

Commit

Permalink
Merge pull request #62 from ochedru/use_release_version_from_github_tag
Browse files Browse the repository at this point in the history
Get release version from Github tag
  • Loading branch information
Olivier Chédru committed Mar 25, 2021
2 parents 00c1d2b + 642b829 commit 1dc85f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@ jobs:
check:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.check_tag.outputs.deploy }}
release_version: ${{ steps.check_tag.outputs.release_version }}
steps:
- name: check tag
id: check_tag
env:
TAG: ${{ steps.get_tag.outputs.tag }}
run: |
if echo "${GITHUB_REF#refs/*/}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$'
TAG=${GITHUB_REF#refs/*/}
if echo "$TAG" | egrep '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$'
then
# the tag looks like a version number: will proceed with release deployment
echo ::set-output name=deploy::y
echo ::set-output name=release_version::$TAG
fi
deploy:
runs-on: ubuntu-latest
needs: [ check, build ]
if: ${{ needs.check.outputs.deploy == 'y' }}
if: ${{ needs.check.outputs.release_version }}
steps:
- uses: actions/checkout@v2
- name: build sdist
run: |
export RELEASE_VERSION=${{ needs.check.outputs.release_version }}
python setup.py sdist
- name: deploy on pypi
uses: pypa/gh-action-pypi-publish@master
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
from os import path, environ

# Always prefer setuptools over distutils
from setuptools import setup

here = path.abspath(path.dirname(__file__))

Expand All @@ -23,7 +24,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.5.1',
version=environ.get('RELEASE_VERSION', 'dev'),

description='Check python packages from requirement.txt and report issues',
long_description=long_description,
Expand Down

0 comments on commit 1dc85f3

Please sign in to comment.