From 3e67d03792d332f02895d10bcab2e673439fd43a Mon Sep 17 00:00:00 2001 From: Ian Harrison Date: Tue, 9 Jul 2024 10:22:35 +0100 Subject: [PATCH] Add automated publishing (#177) * rc1 ver * add publish workflow * switch from test to pypi * update publish.yaml names --- .github/workflows/publish.yaml | 55 ++++++++++++++++++++++++++++++++++ pyproject.toml | 3 +- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..de96b78d --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,55 @@ +name: Upload to PyPI + +on: + release: + types: [published] + +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" + + - 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/ + + testpypi-publish: + name: Upload release to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/soliket + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # user: __token__ + # repository-url: https://test.pypi.org/legacy/ + # print-hash: true + # password: ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 8003f168..9d7dd477 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [project] name = "soliket" -# version = "0.1.dev1" dynamic = ['version'] authors = [ {name = "Simons Observatory"} @@ -62,7 +61,7 @@ include = [ "*" = ['*.yaml', '*.fits', '*.txt', '*.pkl', '*.gz'] [tool.setuptools_scm] -version_file = "soliket/version.py" +version_file = "soliket/_version.py" [project.optional-dependencies] all = [