Skip to content

Commit 8aec54f

Browse files
author
chuanchenlv
committed
Add publish workflow and version
1 parent 8a4eceb commit 8aec54f

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Publish to PyPI"
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
build-n-publish:
8+
name: Build and publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: '3.7'
15+
architecture: 'x64'
16+
- name: Run build script
17+
run: |
18+
echo "VERSION = \"${GITHUB_REF##refs/tags/v}\"" > OpenHowNet/version.py
19+
pip install twine --user
20+
pip install wheel
21+
python setup.py sdist bdist_wheel
22+
- name: Publish a Python distribution to PyPI
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
user: __token__
26+
password: ${{ secrets.PYPI_API_TOKEN }}

OpenHowNet/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = "test"

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import setuptools
22

33
VERSION = "test"
4+
with open("OpenHowNet/version.py", "r") as fver:
5+
VERSION = fver.read().replace("VERSION", "").replace("=", "").replace("\"", "").strip()
46

57
with open("README.md", "r", encoding="utf-8") as fh:
68
long_description = '<h1 align="center">OpenHowNet</h1>\n'+fh.read().split('### [中文版本](README_ZH.md)\n\n')[1]

0 commit comments

Comments
 (0)