Skip to content

Update publishing to Pypi #178

Update publishing to Pypi

Update publishing to Pypi #178

name: publish-pypi
on:
push:
branches:
- master
release:
types: [published]
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
if: github.repository_owner == 'ctlab'
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
if: github.repository_owner == 'ctlab'
- name: Build sdist
shell: bash
run: |
python -m pip install --upgrade pip build
python -m build -s .
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist
manylinux2_28:
name: Build and test Linux wheels
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build wheels
uses: pypa/[email protected]
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: linux-wheels
path: wheelhouse
manylinux2_28_test:
name: Build package from source dist
runs-on: ubuntu-latest
needs: ['build_sdist']
strategy:
matrix:
python: [3.8, 3.9, "3.10"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
pypi-publish:
name: Upload to TestPyPI
runs-on: ubuntu-latest
needs: ['manylinux2_28', 'manylinux2_28_test']
environment:
name: publish-testpypi
url: https://test.pypi.org/p/gadma
permissions:
id-token: write
steps:
- name: Download all
uses: actions/[email protected]
- name: Move to dist
run: |
mkdir dist
cp */*.{whl,gz} dist/.
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1