-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 2.27 KB
/
release-python-client.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
name: Build and publish Python client to PyPI
on:
workflow_call:
inputs:
new-tag-for-python-client-version:
description: 'The new tag value, to be used for the Python client version'
required: true
type: string
checkout-ref:
description: 'The git ref (branch or tag) to checkout before running the workflow'
required: true
type: string
jobs:
build-and-publish:
name: Build and publish Python client to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing (OIDC)
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout-ref }}
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install openapi-generator-cli
run: npm install @openapitools/openapi-generator-cli -g
- name: set version to 7.9.0
run: openapi-generator-cli version-manager set 7.9.0
- name: Generate Python client
run: |
echo "Generating Python client for version ${{ inputs.new-tag-for-python-client-version }}"
openapi-generator-cli generate \
-i common/openapi.yml \
-g python \
-o teaspoons-client \
--additional-properties=projectName=terra-scientific-pipelines-service-api-client,packageName=teaspoons_client,packageVersion=${{ inputs.new-tag-for-python-client-version }},httpUserAgent=terra-scientific-pipelines-service-api-client/${{ inputs.new-tag-for-python-client-version }}/python
- name: Install pypa/build
working-directory: ./teaspoons-client
run: >-
python -m pip install build --user
- name: Build a binary wheel and a source tarball
working-directory: ./teaspoons-client
run: >-
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: ./teaspoons-client/dist
skip_existing: true
attestations: false # https://github.com/pypa/gh-action-pypi-publish/discussions/255