Skip to content

Release flask to PyPI #26

Release flask to PyPI

Release flask to PyPI #26

Workflow file for this run

name: Release flask 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-flask:
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- 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 rai_core_flask
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: rai_core_flask
- name: pip freeze
run: pip freeze
- name: build wheel for wrapped flask
run: python setup.py sdist bdist_wheel
working-directory: rai_core_flask
# run tests before publishing to PyPI
- name: install rai_core_flask wheel locally
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: rai_core_flask
- name: run rai_core_flask tests
run: pytest -s -v ./tests/
working-directory: rai_core_flask
# publish to PyPI
- name: Publish rai_core_flask package to Test PyPI
if: ${{ github.event.inputs.type == 'Test' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_RAI_CORE_FLASK }}
repository_url: https://test.pypi.org/legacy/
packages_dir: rai_core_flask/dist/
- name: Publish rai_core_flask package to PyPI
if: ${{ github.event.inputs.type == 'Prod' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_RAI_CORE_FLASK }}
packages_dir: rai_core_flask/dist/