-
Notifications
You must be signed in to change notification settings - Fork 326
38 lines (32 loc) · 1.08 KB
/
publish-to-pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Publish 📦 to PyPi 🚀
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
jobs:
build-n-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Gets the tag version
id: context
run: |
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/tags/}
- name: Setup the Python Environment by installing Poetry
uses: ./.github/actions/setup-python-build-env
- name: Code Quality Check
shell: bash
run: make install && make tests
- name: Poetry bump version, build and publish
shell: bash
run: |
proj_version=$(poetry version -s)
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
poetry publish --build -u __token__ -p $PYPI_TOKEN
env:
TAG_VERSION: ${{ steps.context.outputs.TAG_VERSION }}
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}