Skip to content

🔒 Upgrade PyPI publishing to use trusted publishing #2

🔒 Upgrade PyPI publishing to use trusted publishing

🔒 Upgrade PyPI publishing to use trusted publishing #2

Workflow file for this run

name: Publish Python Package
on:
push:
tags:
- "releases/v*"
jobs:
deploy:
name: Upload release to PyPI
runs-on: ubuntu-latest
# Set up environment with URL to PyPI project
environment:
name: pypi
url: https://pypi.org/p/heart-centered-prompts
# Add id-token write permission for trusted publishing
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for setuptools_scm to determine version from Git tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
working-directory: ./python
run: |
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
packages-dir: python/dist/
# No password needed with trusted publishing
# Enable verbose output for debugging
verbose: true
# Print hash values of files being uploaded
print-hash: true