Skip to content

Commit

Permalink
[build] trigger pypi build on tags only remove testpypi
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hampel committed Sep 26, 2023
1 parent 198e0b7 commit 4a3100e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Publish PyPI and TestPyPI
name: Publish PyPI

on:
push:
branches: [ unstable ]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
container: # we have to provide a working triqs installation to make the cmake step work
# image: materialstheory/solid_dmft_ci:${{github.ref_name}}
image: materialstheory/solid_dmft_ci

steps:
Expand All @@ -25,9 +28,9 @@ jobs:
--user
- name: prepare python distribution
run: |
cp packaging/pypi/* ./
mkdir build && cd build
cmake ../
cp packaging/pypi/* ../
mv python/solid_dmft/version.py ../python/solid_dmft/version.py
rm ../python/solid_dmft/version.py.in
- name: Build a binary wheel and a source tarball
Expand All @@ -39,8 +42,7 @@ jobs:
path: dist/

publish-to-pypi:
name: Publish to PyPI 🐍
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
name: Publish PyPI 🐍
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -61,27 +63,3 @@ jobs:
with:
skip-existing: true # skip if version name package already exists on pypi

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

environment:
name: pypi
url: https://test.pypi.org/p/solid_dmft

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

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true # skip if version name package already exists on pypi
repository-url: https://test.pypi.org/legacy/
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ add_subdirectory(share)
# executable
add_subdirectory(bin) # Executables

# packaging versions
add_subdirectory(packaging)

# #############
# Debian Package

Expand Down
7 changes: 7 additions & 0 deletions packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Configure the version of packaging files
configure_file(conda/meta.yaml.in conda/meta.yaml)
configure_file(pypi/MANIFEST.in pypi/MANIFEST.in COPYONLY)
configure_file(pypi/pyproject.toml.in pypi/pyproject.toml)
configure_file(solid_dmft-foss-2021b.eb.in solid_dmft-foss-2021b.eb)


2 changes: 1 addition & 1 deletion packaging/conda/meta.yaml → packaging/conda/meta.yaml.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "3.2.0" %}
{% set version = "@PROJECT_VERSION@" %}

package:
name: solid_dmft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ where = ["python"]

[project]
name = "solid_dmft"
version = "3.2.0"
version = "@PROJECT_VERSION@"
authors = [
{ name="Alexander Hampel", email="[email protected]" }
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
easyblock = 'CMakeMake'

name = 'solid_dmft'
version = '3.2.0'
version = '@PROJECT_VERSION@'

homepage = 'https://triqs.github.io/solid_dmft/'
description = """
Expand Down

0 comments on commit 4a3100e

Please sign in to comment.