From a5aeaf0a5cecd551c058da5132b94defcbaf81a5 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Wed, 16 Jun 2021 18:10:21 +0200 Subject: [PATCH 1/2] Create python-publish.yml --- .github/workflows/python-publish.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..3bfabfc --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,36 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +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 build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 86619f1077e45a9b6f21138e8e97888fc9115dd5 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Wed, 16 Jun 2021 18:32:49 +0200 Subject: [PATCH 2/2] take version from tag --- .github/workflows/python-publish.yml | 45 ++++++++++++++++++---------- setup.py | 3 +- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3bfabfc..4230e41 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -18,19 +18,32 @@ jobs: 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 build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - name: 📥 Checkout the repository + uses: actions/checkout@v2 + + - name: 🔢 Get release version + id: version + uses: home-assistant/actions/helpers/version@master + + - name: 🖊️ Set version number + run: | + sed -i '/version=/c\ version="${{ steps.version.outputs.version }}",' "${{ github.workspace }}/setup.py" + + - 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 build + + - name: 📦 Build package + run: python -m build + + - name: 📤 Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/setup.py b/setup.py index 5da9dd6..85e50b3 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -from codecs import open from os import path from setuptools import setup, find_packages @@ -10,7 +9,7 @@ setup( name="deebotozmo", - version="1.8.0", + version="0.0.0", description="a library for controlling certain robot vacuums", long_description=long_description, # Author details