Skip to content

ci: lint Python files using Ruff Linter and Formatter #2

ci: lint Python files using Ruff Linter and Formatter

ci: lint Python files using Ruff Linter and Formatter #2

Workflow file for this run

name: Build & Publish
on:
pull_request:
branches: [main]
release:
types: [published]
permissions: {}
jobs:
python-build:
name: Python Build
runs-on: ubuntu-latest
permissions:
contents: read # Required to checkout the repository.
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version-file: .python-version
- name: Install dependencies
run: python -m pip install --upgrade pip build
- name: Generate distributions
run: python -m build
- name: Upload artifact
id: upload-artifact
if: github.event_name == 'release' && github.event.action == 'published'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: python-package-dist
path: dist
outputs:
artifact-uploaded: ${{ steps.upload-artifact.outcome == 'success' }}
pypi-publish:
name: PyPI Publish
needs: python-build
if: needs.python-build.outputs.artifact-uploaded == 'true'
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # Required for PyPI Trusted Publishing.
steps:
- name: Download artifact
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
name: python-package-dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e