refactor: use modern-style type hints #1433
Workflow file for this run
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
name: Deploy Python Distribution | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Python distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: | | |
python -m pip install build --user | |
- name: Build a wheel and a source tarball | |
run: | | |
python -m build --sdist --wheel --outdir dist/ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gt4py-dist | |
path: ./dist/** | |
publish-pypi: | |
name: Publish Python distribution to pypi.org | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'workflow_dispatch' }} # the action was triggered manually | |
environment: | |
name: pypi | |
url: https://pypi.org/project/gt4py | |
permissions: | |
id-token: write | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v3 | |
with: | |
name: gt4py-dist | |
path: dist | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
publish-test-pypi: | |
name: Publish Python distribution to test.pypi.org | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'release' }} # triggered by releasing on github, test first before manually triggering the deployment to PyPI (see release documentation) | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/project/gt4py/ | |
permissions: | |
id-token: write | |
steps: | |
- name: Download wheel | |
uses: actions/download-artifact@v3 | |
with: | |
name: gt4py-dist | |
path: dist | |
- name: Publish distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |