Skip to content

Upload to PyPI

Upload to PyPI #37

name: Upload to PyPI
on:
workflow_run:
workflows: ["Release Drafter"]
types:
- completed
permissions:
contents: write
jobs:
upload_to_pypi:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
tags: true
ref: main
- name: Get Latest Tag
id: get_version
run: |
VERSION=$(git describe --tags --abbrev=0)
echo "VERSION=${VERSION#v}" >> $GITHUB_ENV
- name: Update __init__.py with Version
run: |
echo "__version__ = '${VERSION}'" > red_plex/__init__.py
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}