Skip to content

Commit 3c5dfb7

Browse files
bsbdsrogercloud
authored andcommitted
feat: add workflows that publishing wheels to github pages
1 parent 28028da commit 3c5dfb7

File tree

2 files changed

+67
-46
lines changed

2 files changed

+67
-46
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
1+
name: Publish Python 🐍 distribution 📦 to GitHub Pages
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
417

518
jobs:
619
build:
@@ -11,66 +24,73 @@ jobs:
1124
- uses: actions/checkout@v4
1225
with:
1326
persist-credentials: false
27+
fetch-depth: 0
28+
1429
- name: Set up Python
1530
uses: actions/setup-python@v5
1631
with:
1732
python-version: "3.x"
33+
1834
- name: Install pypa/build
19-
run: >-
20-
python3 -m
21-
pip install
22-
build
23-
--user
35+
run: |
36+
python3 -m pip install build --user
37+
2438
- name: Build a binary wheel and a source tarball
2539
run: python3 -m build
40+
2641
- name: Store the distribution packages
2742
uses: actions/upload-artifact@v4
2843
with:
2944
name: python-package-distributions
3045
path: dist/
3146

32-
publish-to-pypi:
33-
name: >-
34-
Publish Python 🐍 distribution 📦 to PyPI
35-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36-
needs:
37-
- build
47+
publish-to-github-pages:
48+
name: Publish 📦 to GitHub Pages
49+
needs: build
3850
runs-on: ubuntu-latest
3951
environment:
40-
name: pypi
41-
url: https://pypi.org/p/deepdoc-lib
42-
permissions:
43-
id-token: write # IMPORTANT: mandatory for trusted publishing
52+
name: github-pages
53+
url: ${{ steps.deployment.outputs.page_url }}
4454

4555
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
60+
4661
- name: Download all the dists
4762
uses: actions/download-artifact@v4
4863
with:
4964
name: python-package-distributions
5065
path: dist/
51-
- name: Publish distribution 📦 to PyPI
52-
uses: pypa/gh-action-pypi-publish@release/v1
5366

54-
publish-to-testpypi:
55-
name: Publish Python 🐍 distribution 📦 to TestPyPI
56-
needs:
57-
- build
58-
runs-on: ubuntu-latest
67+
- name: Install dumb-pypi
68+
run: pip install dumb-pypi
5969

60-
environment:
61-
name: testpypi
62-
url: https://test.pypi.org/p/deepdoc-lib
70+
- name: Create package index
71+
run: |
72+
# Put wheels in packages directory
73+
mkdir -p index/packages
74+
cp dist/*.whl index/packages/
75+
76+
# Create package list
77+
ls index/packages/*.whl | xargs -n 1 basename > package_list.txt
78+
79+
# Generate index pointing to ../packages/
80+
dumb-pypi \
81+
--package-list package_list.txt \
82+
--packages-url ../../packages/ \
83+
--output-dir index \
84+
--title "Deepdoc PyPI"
6385
64-
permissions:
65-
id-token: write # IMPORTANT: mandatory for trusted publishing
86+
- name: Setup Pages
87+
uses: actions/configure-pages@v5
6688

67-
steps:
68-
- name: Download all the dists
69-
uses: actions/download-artifact@v4
70-
with:
71-
name: python-package-distributions
72-
path: dist/
73-
- name: Publish distribution 📦 to TestPyPI
74-
uses: pypa/gh-action-pypi-publish@release/v1
89+
- name: Upload artifact
90+
uses: actions/upload-pages-artifact@v3
7591
with:
76-
repository-url: https://test.pypi.org/legacy/
92+
path: 'index'
93+
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@
55
- pip
66

77
``` bassh
8-
pip install git+https://github.com/HuangPuStar/deepdoc-lib.git
8+
pip install deepdoc-lib --extra-index-url https://huangpustar.github.io/deepdoc-lib/simple
99
```
1010
1111
- pyproject
1212
1313
Add the following to pyproject.toml
1414
15+
For uv:
16+
1517
```toml
18+
[[tool.uv.index]]
19+
name = "deepdoc"
20+
url = "https://huangpustar.github.io/deepdoc-lib/simple"
21+
22+
[project]
1623
dependencies = [
17-
# ...
18-
"deepdoc @ git+https://github.com/HuangPuStar/deepdoc-lib.git"
24+
"deepdoc-lib",
1925
]
2026
```
21-
22-
And if you use uv
23-
24-
``` sh
25-
uv sync
2627
```
2728
2829
### Parser Usage

0 commit comments

Comments
 (0)