-
Notifications
You must be signed in to change notification settings - Fork 31
143 lines (118 loc) · 3.49 KB
/
python-package.yml
File metadata and controls
143 lines (118 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
tags:
- '*released'
workflow_dispatch:
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Update version.py
run: |
python update_version.py
- name: Verify version.py
run: |
ls -l mineru_vl_utils/version.py
cat mineru_vl_utils/version.py
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add mineru_vl_utils/version.py
if git diff-index --quiet HEAD; then
echo "No changes to commit"
else
git commit -m "Update version.py with new version"
fi
id: commit_changes
- name: Push changes
if: steps.commit_changes.outcome == 'success'
run: |
git push origin HEAD:main
check-install:
needs: [ update-version ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Verify version.py
run: |
ls -l mineru_vl_utils/version.py
cat mineru_vl_utils/version.py
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install mineru_vl_utils
run: |
python -m pip install --upgrade pip
pip install -e .
build:
needs: [ check-install ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.10"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Install wheel
run: |
python -m pip install wheel
pip install build
- name: Build wheel
run: |
python -m build --wheel
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel-file
path: dist/*.whl
retention-days: 30
release:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: wheel-file
path: dist
- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
with:
files: './dist/*.whl'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Publish distribution to PyPI
run: |
pip install -U twine id keyring packaging readme-renderer requests requests-toolbelt rfc3986 rich urllib3
twine check dist/*
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}