-
Notifications
You must be signed in to change notification settings - Fork 36
56 lines (50 loc) · 1.66 KB
/
pypi.yaml
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
# Release the Descartes Labs Python Client to PyPI
name: Publish to PyPI
on:
# Trigger manually (via Github Web UI) here:
# https://github.com/descarteslabs/descarteslabs-python/actions/workflows/pypi.yaml
#
# Documentation for manually running a workflow:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
inputs:
publish:
description: 'Publish packages to PyPI Repository'
required: true
default: true
type: boolean
repository:
description: 'PyPI Repository to upload package to'
required: true
default: 'pypi'
type: choice
options:
- 'testpypi'
- 'pypi'
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the source code from this repository
- name: Checkout Source Code
uses: actions/checkout@v3
# Setup the Python environment
- name: 'Setup Python Environment'
uses: actions/setup-python@v4
# Build the Python wheel packages
- name: Build Python Packages
run: |
pip install twine
python3 setup.py bdist_wheel
python3 setup.py sdist
# Upload the Python wheel packages to PyPI using an API Token
# https://pypi.org/help/#apitoken
# https://github.com/descarteslabs/paas-infrastructure/blob/main/foundation/operations/pypi.tf
- name: Upload to PyPI
if: inputs.publish
env:
TWINE_REPOSITORY: "${{ inputs.repository }}"
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: "${{ secrets.PYPI_API_TOKEN }}"
run: |
twine upload dist/*