Skip to content

Commit a00f6bc

Browse files
committed
ci(release): add PyPI release workflow
1 parent 8e0e2d1 commit a00f6bc

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish Package to PyPI
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
tests:
8+
name: Run Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.8"
17+
cache: 'pip'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements/dev.txt
23+
24+
- name: Run tests (excluding OpenAI)
25+
run: coverage run -m pytest -m "not open_ai"
26+
27+
- name: Show coverage report
28+
run: coverage report
29+
build-n-publish:
30+
name: Build and Publish
31+
needs: tests
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/p/typesense
36+
permissions:
37+
id-token: write
38+
contents: read
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: "3.8"
48+
cache: pip
49+
50+
- name: Install build dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install build
54+
- name: Build package
55+
run: |
56+
rm -rf dist/
57+
python -m build
58+
- name: Publish to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
attestations: true

0 commit comments

Comments
 (0)