From 170693ff2c51a6a16ad66b5100b6b860c135105e Mon Sep 17 00:00:00 2001 From: owefsad Date: Fri, 24 Dec 2021 09:04:27 +0800 Subject: [PATCH] Feature: add ci (Closes #1) --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ .gitignore | 3 +++ README.md | 22 +++++++++++++++++--- setup.py | 2 +- 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a158ecb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Publish DongTak-SDK-Python + +on: + release: + types: [ created, edited ] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install setuptools wheel twine + + - id: release + run: | + TAG_NAME=${{ github.event.release.tag_name }} + ID=`echo ${TAG_NAME##v}` + echo "::set-output name=VERSION::$ID" + + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + sed -i "s/latest/${{ steps.release.outputs.VERSION }}" setup.py + python setup.py sdist bdist_wheel + twine upload dist/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index f6f6cb3..7ea5ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,6 @@ dmypy.json .pyre/ # pypi config .pypirc + +# PyCharm +.idea diff --git a/README.md b/README.md index f10a270..05828c7 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,35 @@ * @Description: How to use --> # DongTai-SDK-Python -DongTai API SDK + +[![license Apache-2.0](https://img.shields.io/github/license/HXSecurity/DongTai-SDK-Python)](https://github.com/HXSecurity/DongTai-SDK-Python/blob/main/LICENSE) +[![GitHub stars](https://img.shields.io/github/stars/HXSecurity/DongTai-SDK-Python.svg?label=Stars&logo=github)](https://github.com/HXSecurity/DongTai-SDK-Python) +[![GitHub forks](https://img.shields.io/github/forks/HXSecurity/DongTai-SDK-Python?label=Forks&logo=github)](https://github.com/HXSecurity/DongTai-SDK-Python) +[![GitHub Contributors](https://img.shields.io/github/contributors/HXSecurity/DongTai-SDK-Python?label=Contributors&logo=github)](https://github.com/HXSecurity/DongTai-SDK-Python) + + +[![CI](https://github.com/HXSecurity/DongTai-SDK-Python/actions/workflows/release.yml/badge.svg)](https://github.com/HXSecurity/DongTai-SDK-Python/actions/workflows/release.yml) +[![Github Version](https://img.shields.io/github/v/release/HXSecurity/DongTai-SDK-Python?display_name=tag&include_prereleases&sort=semver)](https://github.com/HXSecurity/DongTai-SDK-Python/releases) +[![Release downloads](https://shields.io/github/downloads/HXSecurity/DongTai-SDK-Python/total)](https://github.com/HXSecurity/DongTai-SDK-Python/releases) + + +# Quick start 1.your need a config file config.json +```json { "DongTai":{ "token":"your token", "url":"http://127.0.0.1:90" } } +``` 2.how to use: - +```python from dongtai_sdk.DongTai import DongTai -dongTaiSdk = DongTai("config.json") \ No newline at end of file +dongTaiSdk = DongTai("config.json") +``` + diff --git a/setup.py b/setup.py index 1140a80..9510a8d 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="dongtai_sdk", - version="0.0.2", + version="latest", author="spensercai", author_email="spensercai@gmail.com", description="DongTai SDK",