Version 1.1.1 #2
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: Publish Python Package | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
upload_url: | |
required: true | |
description: upload url of the release the assets need to get uploaded to | |
workflow_call: | |
inputs: | |
upload_url: | |
required: true | |
type: string | |
jobs: | |
build-publish: | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
pip install twine | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
twine check dist/* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifact | |
retention-days: 30 | |
if-no-files-found: error | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
- name: Debug upload_url | |
if: ${{ always() }} | |
run: | | |
echo "event_name: ${{ github.event_name }}" | |
echo "release.upload_url: ${{ github.event.release.upload_url }}" | |
echo "inputs.upload_url: ${{ inputs.upload_url }}" | |
echo "ternary output: ${{ github.event_name == 'release' && github.event.release.upload_url || inputs.upload_url }}" | |
- name: Upload GitHub Release Artifacts | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: "${{ github.event_name == 'release' && github.event.release.upload_url || inputs.upload_url }}" | |
asset_path: 'dist/*' | |
overwrite: true | |