• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Upload Python Package
2
3on:
4  release:
5    types: [published]
6
7permissions:
8  contents: read
9
10jobs:
11  deploy:
12    name: Build and publish Python �� distributions �� to PyPI and TestPyPI
13    runs-on: ubuntu-latest
14
15    steps:
16    - name: Check out from Git
17      uses: actions/checkout@v3
18    - name: Get history and tags for SCM versioning to work
19      run: |
20        git fetch --prune --unshallow
21        git fetch --depth=1 origin +refs/tags/*:refs/tags/*
22    - name: Set up Python
23      uses: actions/setup-python@v3
24      with:
25        python-version: '3.10'
26    - name: Install dependencies
27      run: |
28        python -m pip install --upgrade pip
29        python -m pip install build
30    - name: Build package
31      run: python -m build
32    - name: Publish package to PyPI
33      if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
34      uses: pypa/gh-action-pypi-publish@release/v1
35      with:
36        user: __token__
37        password: ${{ secrets.PYPI_API_TOKEN }}
38