Skip to content

v0.1.3

v0.1.3 #2

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
inputs:
publish_to:
description: "Publish to"
required: true
default: "testpypi"
type: choice
options:
- testpypi
- pypi
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
- name: Build package
run: poetry build
- name: Check package
run: |
pip install twine
twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish-testpypi:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to == 'testpypi'
environment:
name: testpypi
url: https://test.pypi.org/project/value-python/
permissions:
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-pypi:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to == 'pypi')
environment:
name: pypi
url: https://pypi.org/project/value-python/
permissions:
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1