-
-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (41 loc) · 1.25 KB
/
publish.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
48
49
50
name: Publish to PyPI
# on:
# release:
# types: [published] # Trigger the workflow when a release is published.
on:
push:
tags:
- "v*.*.*" # Trigger only on version tags
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12.7
# Cache Poetry dependencies for faster builds
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.venv
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
# Install Poetry
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
# Install dependencies using Poetry
- name: Install dependencies
run: poetry install --no-root
# Build the package using Poetry
- name: Build the package
run: poetry build
- name: Publish to PyPI
run: poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}