Skip to content

Commit

Permalink
Update python-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jeblister authored Sep 10, 2024
1 parent 02e2e56 commit 349f244
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,54 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

name: Build and Publish Manualy

on:
release:
types: [published]
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'testpypi'
type: choice
options:
- testpypi
- pypi

permissions:
contents: read

jobs:
deploy:

build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
python-version: '3.x'
version: 1.5.1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
run: poetry install --no-interaction --no-root
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
run: poetry build
- name: Publish to TestPyPI
if: github.event.inputs.environment == 'testpypi' || github.event_name == 'release'
env:
PYPI_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
poetry config pypi-token.testpypi $PYPI_TOKEN
poetry publish -r testpypi
- name: Publish to PyPI
if: github.event.inputs.environment == 'pypi' || github.event_name == 'release'
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish

0 comments on commit 349f244

Please sign in to comment.