Skip to content

Commit

Permalink
Merge pull request #140 from jpgill86/gh-actions-publish-pypi
Browse files Browse the repository at this point in the history
Add manually-triggerable GitHub Action workflows for publishing to PyPI
  • Loading branch information
jpgill86 committed Jan 23, 2021
2 parents 8a882e0 + 1db0887 commit 768c491
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish to PyPI

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for OFFICIAL release'
required: true
# push:
# tags:
# - '*'

jobs:
publish-pypi:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Checkout tag ${{ github.event.inputs.tag }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}

- name: Build source distribution and wheel
run: |
python setup.py sdist bdist_wheel
- name: List distribution artifacts
run: |
ls -l dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish to TestPyPI

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for TEST release'
required: true
# push:
# tags:
# - '*'

jobs:
publish-test-pypi:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Checkout tag ${{ github.event.inputs.tag }}
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}

- name: Build source distribution and wheel
run: |
python setup.py sdist bdist_wheel
- name: List distribution artifacts
run: |
ls -l dist/
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

0 comments on commit 768c491

Please sign in to comment.