Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and Release on PyPI #3

Merged
merged 5 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish on PyPI

on:
push:
branches:
- "main"
release:
types: [created]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: |
**/setup.py
**/requirements*.txt

- name: Install dependencies
run: |
pip install -r requirements.txt -r requirements-dev.txt

- name: Build wheel
run: |
python setup.py sdist bdist_wheel
twine check dist/*

- name: Upload build for publishing
uses: actions/upload-artifact@v4
with:
name: parse_model_release
if-no-files-found: error
retention-days: 1
path: dist/*

pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: build
environment: release
permissions:
id-token: write
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v4
with:
name: parse_model_release
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
print-hash: true
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
long_description = f.read()

setup(
name='document-model-python',
version='0.1.0',
name='parse-document-model',
version='0.0.2',
description='Pydantic models for representing a text document as a hierarchical structure.',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down