-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (59 loc) · 2.44 KB
/
publish-to-test-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
59
60
61
62
63
64
65
66
67
68
# publish a python package to the test pipy registry - await until the generate clients finishes
name: Publish Python 🐍 distributions 📦 to TestPyPI
#-----------------------------------------------------------------------------------
# Push to TestPyPI unconditionally (need to rev version, del/yank ver will not work)
#
# For testing use:
# on: push
# NOTE:
# The workflow may fail the first time the clients are generate as it does not wait
# for the [Generate OpenAPI Clients] to complete before it executes.
# Don't use final ver number when testing, it will fail when published based on the
# workflows: [Generate OpenAPI Clients])
#
# Once test is completed use:
# on:
# workflow_run:
# workflows: [Generate OpenAPI Clients]
# types:
# - completed
#-----------------------------------------------------------------------------------
# on:
# workflow_run:
# workflows: [Generate OpenAPI Clients]
# types:
# - completed
on: push
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
steps:
# Checkout your code
- uses: actions/checkout@v4
# Check for changed files (looking for changes to the src/python_client/README.md) file)
- name: Get changed file (src/python_client/README.md) 🔧
id: changed-files
uses: tj-actions/changed-files@v39
# Only if the client version has changed
- name: Set up Python
if: contains(steps.changed-files.outputs.modified_files, 'src/python_client/README.md')
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
if: contains(steps.changed-files.outputs.modified_files, 'src/python_client/README.md')
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
if: contains(steps.changed-files.outputs.modified_files, 'src/python_client/README.md')
run: |
cd src/python_client
python -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to Test PyPI
if: contains(steps.changed-files.outputs.modified_files, 'src/python_client/README.md')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: src/python_client/dist/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/