TSPS-348 part one: Publish Python thin client #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish Python client to PyPI | |
on: | |
pull_request: | |
workflow_call: | |
inputs: | |
new-tag: | |
required: true | |
type: string | |
jobs: | |
build-n-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: | |
fetch-depth: 0 | |
- 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.8.0 | |
run: openapi-generator-cli version-manager set 7.8.0 | |
- name: Generate Python client | |
run: | | |
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 || '0.0.0' }},httpUserAgent=terra-scientific-pipeliens-service-api-client/${{ inputs.new-tag || '0.0.0'}}/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 |