Debian Codegraph @

.github/workflows/publish-to-pypi.yml

raw
1 name: Publish 📦 to PyPi 🚀
2
3 on:
4 push:
5 tags:
6 - "[0-9]+.[0-9]+.[0-9]+*"
7
8 jobs:
9 build-n-publish:
10 runs-on: ubuntu-latest
11 steps:
12 - uses: actions/checkout@master
13 - name: Set up Python 3.10
14 uses: actions/setup-python@v5
15 with:
16 python-version: '3.10'
17
18 - name: Gets the tag version
19 id: context
20 run: |
21 echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/}
22
23 - name: Setup the Python Environment by installing Poetry
24 uses: ./.github/actions/setup-python-build-env
25
26 - name: Code Quality Check
27 shell: bash
28 run: make install && make tests
29
30 - name: Poetry bump version, build and publish
31 shell: bash
32 run: |
33 proj_version=$(poetry version -s)
34 if [ $proj_version != $TAG_VERSION ]; then echo "Version $proj_version, defined in pyproject.toml, does not match TAG $TAG_VERSION of this release"; exit 3; fi
35 poetry publish --build -u __token__ -p $PYPI_TOKEN
36 env:
37 TAG_VERSION: ${{ steps.context.outputs.TAG_VERSION }}
38 PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}