Skip to content

Commit

Permalink
TSPS-367 fix again: remove old job dependency (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorgantaylor authored Nov 5, 2024
1 parent ee235a8 commit b4508e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release-python-client.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Build and publish Python client to PyPI

on:
pull_request:
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
needs: [ params-gen ]
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing (OIDC)
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.checkout-ref }}
ref: ${{ inputs.checkout-ref }}

- name: Set up Python 3.12
uses: actions/setup-python@v5
Expand All @@ -38,12 +38,12 @@ jobs:

- name: Generate Python client
run: |
echo "Generating Python client for version ${{ github.event.inputs.new-tag-for-python-client-version }}"
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=${{ github.event.inputs.new-tag-for-python-client-version }},httpUserAgent=terra-scientific-pipelines-service-api-client/${{ github.event.inputs.new-tag-for-python-client-version }}/python
--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
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/tag-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ on:
- 'README.md'
- '.github/**'
pull_request:
paths-ignore:
- 'README.md'
- '.github/**'
workflow_dispatch:
inputs:
bump:
Expand Down Expand Up @@ -111,17 +108,17 @@ jobs:
- name: Generate tag for Java resources, version for Python, and checkout-ref to use in subsequent jobs
id: generate-params
run: |
if [ ${{ github.event_name != 'pull_request' }} ]; then
if [ ${{ github.event_name != 'pull_request' }} == true ]; then
# This workflow was called on a push to main or manually, i.e. a PR merge / new release
echo "New tag provided: ${{ inputs.new-tag }}"
echo "Will use python client version based on tag: ${{ inputs.new-tag }}"
echo "new-tag-for-python-client-version=${{ inputs.new-tag }}" >> $GITHUB_OUTPUT
echo "New tag provided: ${{ steps.tag.outputs.new_tag }}"
echo "Will use python client version based on tag: ${{ steps.tag.outputs.new_tag }}"
echo "new-tag-for-python-client-version=${{ steps.tag.outputs.new_tag }}" >> $GITHUB_OUTPUT
echo "Will use checkout-ref: ${{ inputs.new-tag }}"
echo "checkout-ref=${{ inputs.new-tag }}" >> $GITHUB_OUTPUT
echo "Will use checkout-ref: ${{ steps.tag.outputs.new_tag }}"
echo "checkout-ref=${{ steps.tag.outputs.new_tag }}" >> $GITHUB_OUTPUT
else
# This workflow was called on a PR, and the new tag was not actually created
echo "New tag provided: ${{ inputs.new-tag }}"
echo "New tag provided: ${{ steps.tag.outputs.new_tag }}"
echo "Will use python client version '0.0.0'. This will not overwrite the existing PyPi version '0.0.0'"
echo "new-tag-for-python-client-version='0.0.0'" >> $GITHUB_OUTPUT
Expand All @@ -133,7 +130,6 @@ jobs:
python-client-job:
needs: [ tag-job ]
uses: ./.github/workflows/release-python-client.yml
if: ${{ github.event_name != 'pull_request' }}
with:
new-tag-for-python-client-version: ${{ needs.tag-job.outputs.new-tag-for-python-client-version }}
checkout-ref: ${{ needs.tag-job.outputs.checkout-ref }}
Expand Down

0 comments on commit b4508e1

Please sign in to comment.