Skip to content

Commit

Permalink
Build and Release on PyPI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
avvertix authored Sep 17, 2024
1 parent 7c25fc1 commit 34f1720
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
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

0 comments on commit 34f1720

Please sign in to comment.