Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 64 additions & 28 deletions .github/workflows/pypi-build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: PyPi Build and Deploy 🐍📦
# Workflow from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on:
release:
Expand All @@ -8,43 +8,79 @@ on:
push:
branches:
- main
- update-build-and-deploy

jobs:
build-n-publish:
name: Build and publish ESMValTool on PyPi
build:
name: Build distribution 📦
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/ESMValTool/
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python 3.13
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install pep517
python-version: "3.x"
- name: Install pypa/build
run: >-
python -m
python3 -m
pip install
pep517
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
pep517.build
--source
--binary
--out-dir dist/
.
# - name: Publish distribution to Test PyPI
# uses: pypa/gh-action-pypi-publish@v1.13.0
# with:
# repository-url: https://test.pypi.org/legacy/
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v5
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ESMValTool
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v6
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.13.0
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

Comment thread
bouweandela marked this conversation as resolved.
Outdated
environment:
name: testpypi
url: https://test.pypi.org/p/ESMValTool

Comment thread
bouweandela marked this conversation as resolved.
Outdated
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

Comment thread
bouweandela marked this conversation as resolved.
Outdated
steps:
- name: Download all the dists
uses: actions/download-artifact@v6
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires = [
"setuptools >= 40.6.0",
"setuptools_scm>=6.2",
"setuptools>=80",
"setuptools_scm>=8",
]
build-backend = "setuptools.build_meta"

Expand All @@ -14,7 +14,6 @@ classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
Expand Down Expand Up @@ -87,7 +86,8 @@ dependencies = [
"zarr",
]
description = "A community tool for pre-processing data from Earth system models in CMIP and running analysis scripts"
license = {text = "Apache License, Version 2.0"}
license = "Apache-2.0"
license-files = ["LICENSE", "NOTICE"]
name = "ESMValTool"
requires-python = ">=3.12"

Expand Down Expand Up @@ -136,7 +136,6 @@ Issues = "https://github.com/ESMValGroup/ESMValTool/issues"

[tool.setuptools]
include-package-data = true
license-files = ["LICENSE"]
packages = ["esmvaltool"]
zip-safe = false

Expand Down
Loading