-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (34 loc) · 1.12 KB
/
build-publish-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
39
40
41
42
43
44
45
46
47
name: Build & Publish PyPI
# Build and publish to PyPI
# - official PyPI only on tags that start with `v`
on:
release:
types: [published]
jobs:
build_and_publish_pypi:
runs-on: ubuntu-latest
# Only run this workflow if the tag starts with "v"
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Extract Version from Tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Set version variable in module file
run: sed -i 's/v0.0.0/${{ github.ref_name }}/g' src/sindri/sindri.py
- name: Install poetry
run: pip install poetry
- name: Install Dependencies
run: poetry install
- name: Update project.toml Version
run: poetry version $VERSION
- name: Build and Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build