-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Manual PyPi Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package_repository: | ||
description: '"testpypi" or "pypi"' | ||
required: true | ||
|
||
env: | ||
PYTHON_VERSION: '3.8.2' | ||
|
||
jobs: | ||
testing: | ||
name: Test installed package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Setup caches | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.local/share/virtualenvs | ||
~/.cache/pre-commit | ||
~/.cache/pip | ||
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/Pipfile*') }}-${{ hashFiles('**/.pre-commit-config.yaml*') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.PYTHON_VERSION }}-venv | ||
- name: Install environment | ||
run: | | ||
pip install pipenv | ||
pipenv install --dev --deploy | ||
- name: Test installed package | ||
run: | | ||
pipenv run pip install . | ||
pipenv run pytest | ||
build: | ||
name: Build and release package | ||
runs-on: ubuntu-latest | ||
needs: testing | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Setup caches | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.local/share/virtualenvs | ||
~/.cache/pre-commit | ||
~/.cache/pip | ||
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-venv-${{ hashFiles('**/Pipfile*') }}-${{ hashFiles('**/.pre-commit-config.yaml*') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.PYTHON_VERSION }}-venv | ||
- name: Install pypa/build | ||
run: | | ||
pip install build | ||
python -m build | ||
- name: "Publish a Python distribution to TestPyPi" | ||
if: ${{ github.event.inputs.package_repository == 'testpypi' }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: "Publish a Python distribution to PyPi" | ||
if: ${{ github.event.inputs.package_repository == 'pypi' }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |