-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1015 Bytes
/
publish.yaml
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
name: Publish to PyPI.org
on:
push:
tags: ["v*"]
jobs:
pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build python package
run: |
python3 -m pip install --upgrade build
python3 -m build
- name: Check package version
env:
EXPECTED_VERSION: ${{ github.ref_name }}
run: |
VERSION=$(grep -e "version\s*=\s*" -m 1 pyproject.toml | awk -F '"' '{print $2}')
if [ -z "$VERSION" ]; then
echo "Version not found"
exit 1
fi
if [ "v$VERSION" != "$EXPECTED_VERSION" ]; then
echo "Version $VERSION matches the tag name $EXPECTED_VERSION ."
exit 1
fi
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_TOKEN }}