From bb212f97f40f33ebb5cb3831b6bb923acbfcb0e7 Mon Sep 17 00:00:00 2001 From: Reza Eghbali Date: Mon, 6 May 2024 20:00:14 -0700 Subject: [PATCH 01/10] added publish workflow --- .github/workflows/publish-to-test-pypi.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/publish-to-test-pypi.yml diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml new file mode 100644 index 0000000..de7435f --- /dev/null +++ b/.github/workflows/publish-to-test-pypi.yml @@ -0,0 +1,17 @@ +name: Publish Python distribution package to PyPI and TestPyPI + +on: push + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + From 9747052a27b586933332a5a88dc7ca4cbd4a506a Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 00:13:40 -0700 Subject: [PATCH 02/10] completed the publish workflow --- .github/workflows/publish-to-test-pypi.yml | 69 +++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index de7435f..c184a87 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -1,10 +1,10 @@ -name: Publish Python distribution package to PyPI and TestPyPI +name: Publish Python distribution package to PyPI and TestPyPI on: push jobs: build: - name: Build distribution 📦 + name: Build distribution package runs-on: ubuntu-latest steps: @@ -13,5 +13,70 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" + - 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 + 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/ # Replace with your PyPI project name + 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 PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + publish-to-testpypi: + name: Publish Python distribution package to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/ + + 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 package to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 9d04c444da8f04737832ca50acb8b03acaeed8ea Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 00:46:34 -0700 Subject: [PATCH 03/10] fixed a syntax error --- .github/workflows/publish-to-test-pypi.yml | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index c184a87..9cb391b 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -13,19 +13,19 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.x" - - 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 - with: - name: python-package-distributions - path: dist + - 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 + with: + name: python-package-distributions + path: dist publish-to-pypi: name: >- From ffaac3922b48f268106847c73c2340382ed134c7 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 11:36:55 -0700 Subject: [PATCH 04/10] fixed yaml syntax --- .github/workflows/publish-to-test-pypi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 9cb391b..d77289d 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -10,9 +10,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" + uses: actions/setup-python@v4 + with: + python-version: "3.x" - name: Install pypa/build run: >- python3 -m From 753ba0f5f669979c505e1be3dc44a62edea87340 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 11:43:08 -0700 Subject: [PATCH 05/10] added github release to the publish workflow --- .github/workflows/publish-to-test-pypi.yml | 50 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index d77289d..9dfd6b4 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -72,11 +72,45 @@ jobs: with: repository-url: https://test.pypi.org/legacy/ - steps: - - name: Download all the dists - uses: actions/download-artifact@v3 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + github-release: + name: >- + Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v1.2.3 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' From 69a1285cd13cb05d5c8859bbb0fbc5081e38880d Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 12:04:09 -0700 Subject: [PATCH 06/10] upgraded actions in the workflow --- .github/workflows/publish-to-test-pypi.yml | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 9dfd6b4..92972d1 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install pypa/build @@ -22,14 +22,14 @@ jobs: - 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-pypi: name: >- - Publish Python 🐍 distribution 📦 to PyPI + Publish Python distribution package to PyPI if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes needs: - build @@ -45,7 +45,7 @@ jobs: with: name: python-package-distributions path: dist/ - - name: Publish distribution 📦 to PyPI + - name: Publish distribution package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 publish-to-testpypi: @@ -74,7 +74,7 @@ jobs: github-release: name: >- - Sign the Python 🐍 distribution 📦 with Sigstore + Sign the Python distribution package with Sigstore and upload them to GitHub Release needs: - publish-to-pypi diff --git a/pyproject.toml b/pyproject.toml index e010e4d..d2d085f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyalfe" -version = "0.0.1" +version = "0.1.0" authors = [ {name = "Reza Eghbali", email="eghbali68@gmail.com"}, {email = "reza.eghbali@ucsf.edu"} From dd980d3e9192c13ca504cb09166373d6d2df1633 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 12:49:18 -0700 Subject: [PATCH 07/10] upgraded download-artifacts --- .github/workflows/publish-to-test-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 92972d1..1550594 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -41,7 +41,7 @@ jobs: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ From ccd5db0fa522978f02846d080608dd781fa08fc9 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 12:51:19 -0700 Subject: [PATCH 08/10] upgraded download-artifacts 2 --- .github/workflows/publish-to-test-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 1550594..673e95b 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -63,7 +63,7 @@ jobs: steps: - name: Download all the dists - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ From 6d06e309a1f0fd7335c806710ba1c6068fed72f8 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 12:53:45 -0700 Subject: [PATCH 09/10] package-name -> pyalfe --- .github/workflows/publish-to-test-pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml index 673e95b..e5b96b0 100644 --- a/.github/workflows/publish-to-test-pypi.yml +++ b/.github/workflows/publish-to-test-pypi.yml @@ -36,7 +36,7 @@ jobs: runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/ # Replace with your PyPI project name + url: https://pypi.org/p/pyalfe permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: @@ -56,7 +56,7 @@ jobs: environment: name: testpypi - url: https://test.pypi.org/p/ + url: https://test.pypi.org/p/pyalfe permissions: id-token: write # IMPORTANT: mandatory for trusted publishing From b9a857450540a9c945a96df38b961356754f7969 Mon Sep 17 00:00:00 2001 From: Reza Date: Tue, 7 May 2024 14:35:58 -0700 Subject: [PATCH 10/10] added readme to the toml file --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d2d085f..f091ff1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ authors = [ {name = "Reza Eghbali", email="eghbali68@gmail.com"}, {email = "reza.eghbali@ucsf.edu"} ] +readme = "README.md" dependencies = [ "scipy", "StrEnum",