From 57f98aafa5485ccc9ccd192f40c7e4eb0e431b45 Mon Sep 17 00:00:00 2001 From: Charlotte Avery Date: Fri, 12 Jul 2024 14:17:52 +0100 Subject: [PATCH 1/3] Publish to PyPI upon GitHub release Following: https://www.seanh.cc/2022/05/21/publishing-python-packages-from-github-actions/ --- .github/workflows/publish.yml | 17 +++++++++++++++++ pyproject.toml | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..76d9d52 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,17 @@ +name: Publish to PyPI.org +on: + release: + types: [published] +jobs: + pypi: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: python3 -m pip install --upgrade build && python3 -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a816384 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] From 1bc8de316d67f9b6de79c4900c71f94c01665940 Mon Sep 17 00:00:00 2001 From: Charlotte Avery Date: Fri, 12 Jul 2024 14:28:07 +0100 Subject: [PATCH 2/3] Use latest version --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 76d9d52..217ba41 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - run: python3 -m pip install --upgrade build && python3 -m build From 8c579eb445a84e53d3313b7881d11a2e94cfa98c Mon Sep 17 00:00:00 2001 From: Charlotte Avery Date: Fri, 12 Jul 2024 14:30:39 +0100 Subject: [PATCH 3/3] Use consistent syntax --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 217ba41..b8e8a1b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - run: python3 -m pip install --upgrade build && python3 -m build + - name: Build package + run: python3 -m pip install --upgrade build && python3 -m build - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1 with: