Skip to content

Commit a0df8f3

Browse files
committed
test workflow
1 parent 9185519 commit a0df8f3

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-1
lines changed

.github/workflows/publish_pypi.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish to PyPI via Trusted Publisher
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Update Version"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
11+
publish:
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0 # 确保检出最新的代码
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.9"
28+
29+
- name: Install dependencies
30+
run: |
31+
pip install --upgrade setuptools wheel build
32+
33+
- name: Build the package
34+
run: |
35+
python setup.py sdist bdist_wheel
36+
37+
- name: Pypi Publish
38+
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update Version
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
update-version:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # 确保可以获取完整的分支信息
20+
21+
- name: Switch to main branch
22+
run: |
23+
git checkout main # 将 "main" 替换为你的默认分支名
24+
25+
- name: Update _version.py
26+
run: |
27+
TAG_NAME=$(echo ${{ github.ref_name }})
28+
echo "__version__ = '${TAG_NAME:1}'" > pyfmm/_version.py
29+
30+
- name: Commit changes
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
git add pyfmm/_version.py
35+
git commit -m "Update version to ${{ github.ref_name }}"
36+
git push origin main # 推送到 "main" 分支
37+
38+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/build
2+
/dist
23
/.vscode
34
/*.egg-info
45
/docs/build

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ def read_version():
3838
exec(f.read())
3939
return locals()['__version__']
4040

41+
def read_readme():
42+
with open("README.md", encoding="utf-8") as f:
43+
return f.read()
44+
4145
setup(
42-
name='pyfmm',
46+
name='pyfmm-kit',
4347
version=read_version(),
4448
description='A C/Python package for solving eikonal equation using Fast Marching Method',
4549
author='Zhu Dengda',
4650
author_email='[email protected]',
51+
long_description=read_readme(),
52+
long_description_content_type="text/markdown",
4753
packages=find_packages(),
4854
package_data={'pyfmm': ['./C_extension/lib/libfmm_float.so', './C_extension/lib/libfmm_double.so']},
4955
include_package_data=True,

0 commit comments

Comments
 (0)