Skip to content

Commit

Permalink
ci: support pythonv2 publishing in a backwards compatible manner (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanSpeakEasy authored Jun 13, 2024
1 parent 2f20177 commit e434512
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/sdk-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,26 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
- name: Check for publish.sh
id: check-publish
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if [ -f scripts/publish.sh ]; then
echo "publish_with_makefile=true" >> $GITHUB_OUTPUT
fi
- name: Publish with Makefile
if: steps.check-publish.outputs.publish_with_makefile == 'true'
env:
PYPI_TOKEN: ${{ secrets.pypi_token }}
run: |
make publish
- name: Legacy publish
if: steps.check-publish.outputs.publish_with_makefile != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
- id: publish-event
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/workflow-executor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,26 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
- name: Check for publish.sh
id: check-publish
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if [ -f scripts/publish.sh ]; then
echo "publish_with_makefile=true" >> $GITHUB_OUTPUT
fi
- name: Publish with Makefile
if: steps.check-publish.outputs.publish_with_makefile == 'true'
env:
PYPI_TOKEN: ${{ secrets.pypi_token }}
run: |
make publish
- name: Legacy publish
if: steps.check-publish.outputs.publish_with_makefile != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
- id: publish-event
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ inputs:
push_code_samples_only:
description: "This will generate code samples, tag them with the `main` branch name, and push them to the registry. It will not create a pull request or commit any code. This is useful for pushing up some code samples to the registry the first time when there are no code samples in the registry."
required: false
target_directory:
description: "The directory the SDK target was generated to"
required: false
registry_name:
description: "The name of the publishing registry"
required: false
outputs:
publish_python:
description: "Whether the Python SDK will be published to PyPi"
Expand Down Expand Up @@ -179,4 +185,3 @@ runs:
- ${{ inputs.target_directory }}
- ${{ inputs.sources }}
- ${{ inputs.code_samples }}

0 comments on commit e434512

Please sign in to comment.