Skip to content

Commit

Permalink
Remove local varsion to enable uploading to PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
noscode committed Nov 6, 2024
1 parent df9c1b7 commit f90d3ae
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 38 deletions.
66 changes: 28 additions & 38 deletions .github/workflows/publication_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,91 +9,81 @@ on:

jobs:
build:
name: Build Python distributions
runs-on: ubuntu-20.04
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
if: github.repository_owner == 'ctlab'

- name: Check out src from Git
uses: actions/checkout@v4

- 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: Install GADMA and its dependencies.
run: |
python3 -m pip install setuptools --upgrade
python3 -m pip install numpy
python3 -m pip install Cython
python3 -m pip install dadi
python3 -m pip install --user --upgrade setuptools wheel
if: github.repository_owner == 'ctlab'
- name: Install pypa/build
run: python3 -m pip install build --user

- name: Install pypa/build
run: python3 -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish distribution 📦 to TestPyPI
if: github.repository_owner == 'ctlab'
publish-to-pypi:
name: Publish distribution 📦 to PyPI
if: github.repository_owner == 'ctlab' && github.event.release
needs:
- build
runs-on: ubuntu-20.04

runs-on: ubuntu-latest
environment:
name: publish-testpypi
url: https://test.pypi.org/p/gadma

name: publish-pypi
url: https://pypi.org/p/gadma
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-to-pypi:
name: Publish distribution 📦 to PyPI
if: github.repository_owner == 'ctlab' && github.event.release
publish-to-testpypi:
name: Publish distribution 📦 to TestPyPI
if: github.repository_owner == 'ctlab'
needs:
- build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

environment:
name: publish-pypi
url: https://pypi.org/p/gadma
name: publish-testpypi
url: https://test.pypi.org/p/gadma

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish distribution 📦 to PyPI
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
# We need setup.cfg support, which setuptools introduced in 30.3.0.
requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
local_scheme = "no-local-version"

0 comments on commit f90d3ae

Please sign in to comment.