From 6e1f8c1de393ba60adea17dc996ec426420098da Mon Sep 17 00:00:00 2001 From: Christian Beilschmidt Date: Mon, 27 Nov 2023 15:45:29 +0100 Subject: [PATCH] publish workflow for PyPI --- .github/workflows/publish.yml | 39 +++++++++++++++++++++++++++++++++++ .github/workflows/python.yml | 4 ++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6560ebe --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +# This workflows builds the library and publishes it on PyPI. + +name: Build & Publish + +on: + workflow_run: + workflows: [Test] + types: [completed] + branches: [main] + +jobs: + publish: + name: Publish + + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.8"] # use lowest supported Python version + + environment: + name: pypi + url: https://pypi.org/p/geoengine-openapi-client + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a58f244..c74822b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -3,7 +3,7 @@ # # ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: geoengine_sys Python package +name: Test on: [push, pull_request] @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + # pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi # - name: Lint with flake8