-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (66 loc) · 2.03 KB
/
python-deploy-to-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
57
58
59
60
61
62
63
64
65
66
67
68
---
name: pypi_deploy
'on':
workflow_call:
inputs:
additional_packages:
default: ''
description: String of additional packages that should be installed.
required: false
type: string
jobs_run_on:
default: ubuntu-latest
description: The runner group on which jobs will run.
required: false
type: string
python_version:
description: The version of Python to use for the run.
default: '3.11'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
required: false
type: number
working_directory:
description: The working directory where all jobs should be executed.
default: '.'
required: false
type: string
secrets:
pypi_token:
description: The PyPi token to use to deploy.
required: true
jobs:
pypi_deploy:
defaults:
run:
working-directory: ${{ inputs.working_directory }}
runs-on: ${{ inputs.jobs_run_on }}
steps:
- name: Install additional packages
if: ${{ inputs.additional_packages != '' }}
run: sudo apt-get install -y ${{ inputs.additional_packages }}
- name: Checkout repo
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: "Set up Python ${{ inputs.python_version }}"
uses: actions/setup-python@v5
with:
cache: poetry
python-version: "${{ inputs.python_version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Setup PyPi credential
env:
PYPI_TOKEN: ${{ secrets.pypi_token }}
run: poetry config pypi-token.pypi "$PYPI_TOKEN"
- name: Package build
run: poetry build
- name: Publish package to PyPi
run: poetry publish
timeout-minutes: ${{ inputs.timeout_minutes }}