From 0b33b798e4a9d5e6f13df7a3d3a0e90dbe34643e Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 17 Feb 2020 20:16:24 +0100 Subject: [PATCH 1/3] Add pypi build step --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++++- freqtrade/__init__.py | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05d151a88..cc8906af5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ on: - develop - github_actions_tests tags: + release: + types: [published] pull_request: schedule: - cron: '0 5 * * 4' @@ -191,15 +193,40 @@ jobs: deploy: needs: [ build, build_windows, docs_check ] runs-on: ubuntu-18.04 - if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'freqtrade/freqtrade' + if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'release') && github.repository == 'freqtrade/freqtrade' steps: - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Extract branch name shell: bash run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" id: extract_branch + - name: Build distribution + run: | + pip install -U setuptools wheel + python setup.py sdist bdist_wheel + + - name: Publish to PyPI (Test) + uses: pypa/gh-action-pypi-publish@master + if: (steps.extract_branch.outputs.branch == 'master' || github.event_name == 'release') + with: + user: __token__ + password: ${{ secrets.pypi_test_password }} + repository_url: https://test.pypi.org/legacy/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + if: (steps.extract_branch.outputs.branch == 'master' || github.event_name == 'release') + with: + user: __token__ + password: ${{ secrets.pypi_password }} + - name: Build and test and push docker image env: IMAGE_NAME: freqtradeorg/freqtrade diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index e1f65d4fe..f2ae5dc63 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -1,4 +1,4 @@ -""" FreqTrade bot """ +""" Freqtrade bot """ __version__ = 'develop' if __version__ == 'develop': From 1172c958174424e138d9391dfcd90db6e6856705 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 17 Feb 2020 20:17:08 +0100 Subject: [PATCH 2/3] Use different versioning scheme --- freqtrade/__init__.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index f2ae5dc63..23ab945b4 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -5,9 +5,23 @@ if __version__ == 'develop': try: import subprocess - __version__ = 'develop-' + subprocess.check_output( - ['git', 'log', '--format="%h"', '-n 1'], - stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') + + # __version__ = 'develop-' + subprocess.check_output( + # ['git', 'log', '--format="%h"', '-n 1'], + # stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') + + from datetime import datetime + last_release = subprocess.check_output( + ['git', 'tag'] + ).decode('utf-8').split()[-1].split(".") + # Releases are in the format "2020.1" - we increment the latest version for dev. + prefix = f"{last_release[0]}.{int(last_release[1]) + 1}" + dev_version = int(datetime.now().timestamp() // 1000) + __version__ = f"{prefix}.dev{dev_version}" + + # subprocess.check_output( + # ['git', 'log', '--format="%h"', '-n 1'], + # stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') except Exception: # git not available, ignore pass From e6dd463ca3ad7803e1e6df391d3917d32142368e Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 17 Feb 2020 20:17:36 +0100 Subject: [PATCH 3/3] Revert versioning --- freqtrade/__init__.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/freqtrade/__init__.py b/freqtrade/__init__.py index 23ab945b4..ad432a20b 100644 --- a/freqtrade/__init__.py +++ b/freqtrade/__init__.py @@ -6,18 +6,18 @@ if __version__ == 'develop': try: import subprocess - # __version__ = 'develop-' + subprocess.check_output( - # ['git', 'log', '--format="%h"', '-n 1'], - # stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') + __version__ = 'develop-' + subprocess.check_output( + ['git', 'log', '--format="%h"', '-n 1'], + stderr=subprocess.DEVNULL).decode("utf-8").rstrip().strip('"') - from datetime import datetime - last_release = subprocess.check_output( - ['git', 'tag'] - ).decode('utf-8').split()[-1].split(".") - # Releases are in the format "2020.1" - we increment the latest version for dev. - prefix = f"{last_release[0]}.{int(last_release[1]) + 1}" - dev_version = int(datetime.now().timestamp() // 1000) - __version__ = f"{prefix}.dev{dev_version}" + # from datetime import datetime + # last_release = subprocess.check_output( + # ['git', 'tag'] + # ).decode('utf-8').split()[-1].split(".") + # # Releases are in the format "2020.1" - we increment the latest version for dev. + # prefix = f"{last_release[0]}.{int(last_release[1]) + 1}" + # dev_version = int(datetime.now().timestamp() // 1000) + # __version__ = f"{prefix}.dev{dev_version}" # subprocess.check_output( # ['git', 'log', '--format="%h"', '-n 1'],