Skip to content

Commit

Permalink
Setup github actions to automatically publish to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
jwon committed Mar 16, 2020
1 parent 09c1d57 commit 977d563
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/create-release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create Release and publish to pypi.org on Version Change

on:
push:
paths:
- 'src/iris_relay/__init__.py'
branches:
- master

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Get version
id: get_version
run: echo "::set-output name=version::$(grep -Po '\d*\.\d*\.\d*' src/iris_relay/__init__.py)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish to test.pypi.org
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Publish to pypi.org
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
22 changes: 20 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@


import setuptools
import re


with open('src/iris/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)

with open('README.md', 'r') as fd:
long_description = fd.read()

setuptools.setup(
name='iris-relay',
version='0.2.0',
name='irisrelay',
version=version,
description='Stateless reverse proxy for thirdparty service integration with Iris API.',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/linkedin/iris-relay',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 3'
],
package_dir={'': 'src'},
packages=setuptools.find_packages('src'),
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion src/iris_relay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.

__version__ = '1.0.0'
__version__ = '1.1.0'

0 comments on commit 977d563

Please sign in to comment.