Skip to content

Commit

Permalink
Add manual release workflow #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Körber authored Jul 20, 2021
2 parents 33b97ee + 557e848 commit fadb9f3
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
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 }}

0 comments on commit fadb9f3

Please sign in to comment.