Skip to content

doc & build

doc & build #3

Workflow file for this run

# github action build python package
name: Build Python Package
on:
push:
branches: [ main ]
tags: ['*']
workflow_dispatch:
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 build dependencies
run: |
python -m pip install build
- name: Build package using build
run: |
python -m build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
# job to upload the package to PyPI
upload-to-pypi:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/<your-pypi-project-name>
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true