Skip to content

Commit a2bfad3

Browse files
authored
chore: refine pypi github workflows (#16)
chore: refine pypi publish workflow - make version dynamic - publish to TestPyPI on tag pushes only - publish to PyPI via manual dispatch only
1 parent 7543331 commit a2bfad3

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# This workflow handles the distribution of Python packages.
2+
# 1. Automatic: Every push/tag builds the distribution.
3+
# 2. Automatic: Tag pushes (refs/tags/*) deploy to TestPyPI.
4+
# 3. Manual: Production releases to PyPI require a manual trigger (workflow_dispatch)
5+
# to prevent accidental deployments.
6+
17
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
28

3-
on: push
9+
on:
10+
push:
11+
workflow_dispatch:
412

513
jobs:
614
build:
@@ -32,7 +40,8 @@ jobs:
3240
publish-to-pypi:
3341
name: >-
3442
Publish Python 🐍 distribution 📦 to PyPI
35-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
43+
# Manual dispatch required to prevent accidental production releases
44+
if: github.event_name == 'workflow_dispatch'
3645
needs:
3746
- build
3847
runs-on: ubuntu-latest
@@ -53,6 +62,7 @@ jobs:
5362

5463
publish-to-testpypi:
5564
name: Publish Python 🐍 distribution 📦 to TestPyPI
65+
if: startsWith(github.ref, 'refs/tags/') # only publish to TestPyPI on tag pushes
5666
needs:
5767
- build
5868
runs-on: ubuntu-latest

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools >= 77.0.3", "wheel"]
2+
requires = ["setuptools >= 77.0.3", "setuptools-scm", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "deepdoc_lib"
7-
version = "0.1.0"
7+
dynamic = ["version"]
88
description = "[RAGFlow](https://ragflow.io/) is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. It offers a streamlined RAG workflow for businesses of any scale, combining LLM (Large Language Models) to provide truthful question-answering capabilities, backed by well-founded citations from various complex formatted data."
99
authors = [{ name = "Zhichang Yu", email = "yuzhichang@gmail.com" }]
1010
license-files = ["LICENSE"]
@@ -94,3 +94,7 @@ markers = [
9494
"p2: medium priority test cases",
9595
"p3: low priority test cases",
9696
]
97+
98+
[tool.setuptools_scm]
99+
write_to = "deepdoc/_version.py"
100+
fallback_version = "0.1.0"

0 commit comments

Comments
 (0)