Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get release version from Github tag #62

Merged
merged 2 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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