Skip to content

Commit 1c8781c

Browse files
committed
test workflow
1 parent 9185519 commit 1c8781c

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

.github/workflows/publish_pypi.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Tag/Release and Publish to PyPI via Trusted Publisher
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+
39+
40+
publish:
41+
runs-on: ubuntu-latest
42+
43+
permissions:
44+
id-token: write
45+
contents: read
46+
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v3
50+
51+
- name: Set up Python
52+
uses: actions/setup-python@v4
53+
with:
54+
python-version: "3.9"
55+
56+
- name: Install dependencies
57+
run: |
58+
pip install --upgrade setuptools wheel build
59+
60+
- name: Build the package
61+
run: |
62+
python setup.py sdist bdist_wheel
63+
64+
- name: Pypi Publish
65+
uses: pypa/gh-action-pypi-publish@release/v1

.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)