Skip to content

Publish to PyPI.

Publish to PyPI. #9

Workflow file for this run

on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
branches: [ main ]
name: Publish package
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: |
python -m pip install build
- name: Build a binary wheel and a source tarball
run: |
python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: python-artifacts
path: dist
# This assumes a PyPI Trusted Publisher has been configured for the `outpack` package.
# See https://docs.pypi.org/trusted-publishers/ for more details.
publish-to-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Publish Python distribution to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/outpack
permissions:
# This permission is needed for the workflow to authenticate against PyPI
id-token: write
steps:
- name: Download the artifacts
uses: actions/download-artifact@v3
with:
name: python-artifacts
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1