From 156de15ac0db636e4b11cdbb5140f2c4c1123c51 Mon Sep 17 00:00:00 2001 From: Chen Zhang Date: Wed, 3 Jul 2024 18:04:00 +0000 Subject: [PATCH] add PyPI publishing actions --- .github/workflows/package.yml | 25 +++++++++++++++++++++++++ pyproject.toml | 2 ++ tests/bm3dornl-data | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index e2aaa65..52121b6 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -45,3 +45,28 @@ jobs: if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi echo pushing ${{ github.ref }} with label $CONDA_LABEL anaconda upload --label $CONDA_LABEL conda.recipe/noarch/bm3dornl*.tar.bz2 + + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v3 + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + channels: conda-forge,defaults + mamba-version: "*" + environment-file: environment.yml + cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }} + cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }} + - name: build pypi pacakge + run: | + # build the package + VERSION=$(versioningit .) python -m build + # retrieve your distributions here + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index c2fb1df..88bdf50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ dependencies = [ ] license = { text = "MIT" } keywords = ["BM3D", "image processing", "neutron imaging", "denoising", "CuPy", "Numba"] +readme = "README.md" [project.urls] homepage = "https://github.com/neutrons/python_project_template/" @@ -19,6 +20,7 @@ repository = "https://github.com/ornlneutronimaging/bm3dornl" documentation = "https://bm3dornl.readthedocs.io/en/latest/" issues = "https://github.com/ornlneutronimaging/bm3dornl/issues" + [build-system] requires = [ "setuptools >= 40.6.0", diff --git a/tests/bm3dornl-data b/tests/bm3dornl-data index 984b049..58e0193 160000 --- a/tests/bm3dornl-data +++ b/tests/bm3dornl-data @@ -1 +1 @@ -Subproject commit 984b049ff036496e02ed154b35139873abb3d445 +Subproject commit 58e0193028d7357ca3a87f7232d3fcde62ecc1f6