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

add github action to release raiutils to pypi #1294

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/release-raiutils.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release raiutils to PyPI

# trigger manually only ("collaborator" or more permissions required)
on:
workflow_dispatch:
inputs:
type:
description: "Test or Prod PyPI?"
required: true
default: "Test"

jobs:
release-raiutils:
runs-on: ubuntu-latest
steps:
- name: fail if Test nor Prod
if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }}
run: |
echo "Only Test or Prod can be used."
exit 1

# build wheel
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: update and upgrade pip, setuptools, wheel, and twine
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine

- name: install requirements.txt for raiutils
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: raiutils

- name: pip freeze
run: pip freeze

- name: build wheel for raiutils
run: python setup.py sdist bdist_wheel
working-directory: raiutils

# run tests before publishing to PyPI

- name: install raiutils wheel locally
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: raiutils

- name: run raiutils tests
run: pytest ./tests/
working-directory: raiutils

# publish to PyPI
- name: Publish raiutils package to Test PyPI
if: ${{ github.event.inputs.type == 'Test' }}
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_RAIUTILS }}
repository_url: https://test.pypi.org/legacy/
packages_dir: raiutils/dist/
- name: Publish raiutils package to PyPI
if: ${{ github.event.inputs.type == 'Prod' }}
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_RAIUTILS }}
packages_dir: raiutils/dist/