-
Notifications
You must be signed in to change notification settings - Fork 12
58 lines (56 loc) · 1.81 KB
/
release-to-pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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.10'
- 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