Skip to content

Commit 34f1720

Browse files
authored
Build and Release on PyPI (#3)
1 parent 7c25fc1 commit 34f1720

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish on PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
release:
8+
types: [created]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 1
20+
21+
- name: Set up Python 3.12
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.12'
25+
cache: pip
26+
cache-dependency-path: |
27+
**/setup.py
28+
**/requirements*.txt
29+
30+
- name: Install dependencies
31+
run: |
32+
pip install -r requirements.txt -r requirements-dev.txt
33+
34+
- name: Build wheel
35+
run: |
36+
python setup.py sdist bdist_wheel
37+
twine check dist/*
38+
39+
- name: Upload build for publishing
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: parse_model_release
43+
if-no-files-found: error
44+
retention-days: 1
45+
path: dist/*
46+
47+
pypi-publish:
48+
name: Upload release to PyPI
49+
runs-on: ubuntu-latest
50+
needs: build
51+
environment: release
52+
permissions:
53+
id-token: write
54+
steps:
55+
- name: Download math result for job 1
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: parse_model_release
59+
path: dist
60+
61+
- name: Publish package distributions to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
64+
with:
65+
print-hash: true

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
long_description = f.read()
1010

1111
setup(
12-
name='document-model-python',
13-
version='0.1.0',
12+
name='parse-document-model',
13+
version='0.0.2',
1414
description='Pydantic models for representing a text document as a hierarchical structure.',
1515
long_description=long_description,
1616
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)