Skip to content

Publish to PyPI

Publish to PyPI #24

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [published]
jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ape-core
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Extract package directory from release title
id: extract-package-dir
run: |
PACKAGE_DIR=$(echo '${{ github.event.release.name }}' | sed -n 's/^Release \(.*\) v[0-9].*$/\1/p')
echo "package_dir=/libs/$PACKAGE_DIR" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
cd ${{ github.workspace }}${{ env.package_dir }}
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ${{ github.workspace }}${{ env.package_dir }}/dist