Skip to content

Publish Existing Tag to PyPI #1

Publish Existing Tag to PyPI

Publish Existing Tag to PyPI #1

name: Publish Existing Tag to PyPI
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g., v1.0.2)'
required: true
default: 'v1.0.2'
jobs:
build-and-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
# IMPORTANT: This permission is required for trusted publishing
permissions:
id-token: write
steps:
- name: Checkout specific tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build distribution
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# No need for username/password with trusted publishing!