From 8d2320f44fa8107391d5641ebbe9982f448493f4 Mon Sep 17 00:00:00 2001 From: solidiquis Date: Mon, 24 Jun 2024 17:24:06 -0700 Subject: [PATCH] python(ci): PyPI publishing workflow --- .github/workflows/python_release.yaml | 46 +++++++++++++++++++ .github/workflows/python_release_dry_run.yaml | 3 +- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python_release.yaml diff --git a/.github/workflows/python_release.yaml b/.github/workflows/python_release.yaml new file mode 100644 index 00000000..bb8f34f1 --- /dev/null +++ b/.github/workflows/python_release.yaml @@ -0,0 +1,46 @@ +name: PyPI Publish + +on: + workflow_dispatch: + +jobs: + python-ci: + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags') + uses: ./.github/workflows/python_ci.yaml + + publish-to-pypi: + name: Upload release to PyPI + needs: python-ci + runs-on: ubuntu-latest + defaults: + run: + working-directory: python + environment: + name: pypi + url: https://pypi.org/p/sift_py + permissions: + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Pip install + run: | + python -m pip install --upgrade pip + pip install '.[build]' + pip install . + + - name: Build distributions + working-directory: python + run: | + python -m build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: ./python/dist/ diff --git a/.github/workflows/python_release_dry_run.yaml b/.github/workflows/python_release_dry_run.yaml index 1e58acc4..74d2627b 100644 --- a/.github/workflows/python_release_dry_run.yaml +++ b/.github/workflows/python_release_dry_run.yaml @@ -1,7 +1,6 @@ -name: PyPI Publish +name: PyPI Publish (Test) on: - pull_request: workflow_dispatch: jobs: