Skip to content

Use gh-action-pypi-publish instead of pdm publish to work-around "Fai… #11

Use gh-action-pypi-publish instead of pdm publish to work-around "Fai…

Use gh-action-pypi-publish instead of pdm publish to work-around "Fai… #11

Workflow file for this run

name: Continuous integration
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
jobs:
tests:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install dependencies
run: pdm sync
- name: Run pytest
run: pdm test
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.12"
cache: true
- name: Install dependencies
run: pdm sync
- name: Run linting
run: pdm lint
publish:
name: Publish to PyPI
if: github.ref_type == 'tag'
needs: [tests, linting]
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
- name: Build
run: pdm build
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1