Build & Publish #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
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: | | |
pip install --upgrade build | |
python3 -m build | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |