-
Notifications
You must be signed in to change notification settings - Fork 235
69 lines (63 loc) · 1.87 KB
/
build_and_publish_sdk.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
69
name: "Build and Publish SDK"
run-name: "Build SDK ${{ github.ref_name }} by @${{ github.actor }}"
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: Version
default: ""
is_release:
type: boolean
required: false
default: false
workflow_call:
inputs:
version:
type: string
required: true
description: Version
default: ""
is_release:
type: boolean
required: false
default: false
push:
branches:
- 'main'
paths:
- "sdks/python/**"
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Setup
id: setup
run: |
if [[ "${{inputs.version}}" == "" ]]; then
echo "build_from=${{github.ref_name}}" | tee -a $GITHUB_OUTPUT
else
echo "build_from=${{inputs.version}}" | tee -a $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{steps.setup.outputs.build_from}}
fetch-tags: true
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Build pip package
run: |
cd sdks/python
pip3 install -U pip build
if [[ "${{inputs.version}}" != "" ]]; then export VERSION=${{inputs.version}};fi
python3 -m build --sdist --wheel --outdir dist/ .
- name: Publish package distributions to PyPI
if: inputs.is_release
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: sdks/python/dist