-
Notifications
You must be signed in to change notification settings - Fork 12
45 lines (36 loc) · 1.06 KB
/
main.yml
File metadata and controls
45 lines (36 loc) · 1.06 KB
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
39
40
41
42
43
44
45
name: Publish Python Package
on:
workflow_dispatch:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Check if tag matches the Poetry version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v} # Strips 'refs/tags/v' leaving just the version number.
POETRY_VERSION=$(poetry version --short)
echo "Tag version: $TAG_VERSION"
echo "Poetry version: $POETRY_VERSION"
if [[ "$TAG_VERSION" != "$POETRY_VERSION" ]]; then
echo "Error: Tag version ($TAG_VERSION) does not match the version in pyproject.toml ($POETRY_VERSION)"
exit 1
fi
shell: bash
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- name: Cache deps
run: poetry install
- name: Build
run: poetry build
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish