Skip to content

update readme and fix action on pr complete #6

update readme and fix action on pr complete

update readme and fix action on pr complete #6

Workflow file for this run

name: Build & Publish to PyPI
on:
# Dry-run triggers
pull_request:
branches:
- master
workflow_dispatch:
# Publish trigger: only when the PR merge commits are pushed to master
push:
branches:
- master
permissions:
contents: read # for checkout
id-token: write # for OIDC
packages: write # for GitHub Packages
jobs:
dry-run:
name: Dry-Run Build & Check
runs-on: ubuntu-latest
# Allow dry-run on pull_request and workflow_dispatch events
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install build tools
run: |
python -m pip install --upgrade pip setuptools wheel build twine
- name: Build the package
run: python -m build --sdist --wheel
- name: Validate the package with Twine
run: python -m twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: built-package
path: dist/*
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
# Only fire on the push-to-master that completes the PR
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install publish tools
run: |
python -m pip install --upgrade pip setuptools wheel build twine
- name: Build the package
run: python -m build --sdist --wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
run: |
# avoid failures if you accidentally re-publish the same version
python -m twine upload --skip-existing dist/*