Release to PyPi & Deploy docs #22
Workflow file for this run
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
# Checkout master, create sdist and bdist, and release to pypi | |
name: Release to PyPi & Deploy docs | |
on: | |
workflow_dispatch: | |
inputs: | |
pypi-target: | |
description: Deploy to PyPi [Main] or [Test] | |
required: true | |
default: 'Main' | |
push: | |
tags: | |
- v*.* | |
jobs: | |
deploy-pypi: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: Create dist | |
run: | | |
python -m pip install --upgrade pip | |
pip install twine build | |
python -m build | |
- name: Validate dist | |
run: twine check dist/* | |
- if: github.event.inputs.pypi-target == 'Main' || github.event_name == 'push' | |
name: Publish to PyPi | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
twine upload dist/* | |
- if: github.event.inputs.pypi-target == 'Test' | |
name: Publish to Test-PyPi | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }} | |
run: | | |
twine upload --repository testpypi dist/* | |
- if: github.event.inputs.pypi-target == 'Main' || github.event_name == 'push' | |
name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-north-1 | |
- if: github.event.inputs.pypi-target == 'Main' || github.event_name == 'push' | |
name: Publish docs | |
run: | | |
pip install awscli | |
pip install .[docs] | |
mkdocs build -f docs/mkdocs.yml | |
make docs-deploy |