Skip to content

Commit

Permalink
temp (#81)
Browse files Browse the repository at this point in the history
* Update packages in dev.txt

* Update packages in requirement file

* fix bump

* fix bump 2

* fix bump 3

* fix bump 4

* fix bump 5

* fix bump 6

* Update version, file: setup.py

* Update version, file: setup.py

* Update version, file: .bumpversion.cfg

* Update version, file: .bumpversion.cfg

* update mergify
  • Loading branch information
shlomiLan committed Apr 10, 2020
1 parent dbf34ce commit 870927d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.5
current_version = 1.1.6
tag = False
commit = False
message = Bump version: {current_version} -> {new_version} [ci skip]
Expand Down
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pull_request_rules:
- name: Automatic merge on CI success
conditions:
- status-success=continuous-integration/travis-ci/pr
- status-success="Travis CI - Pull Request"
- base=master
actions:
merge:
Expand Down
8 changes: 4 additions & 4 deletions dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# install all base requirements
-r requirements.txt

python_http_client==3.2.6
python_http_client==3.2.7

invoke==1.4.1
twine==3.1.1

# Tests
pytest==5.4.1
pytest-cov==2.8.1
codecov==2.0.16
codecov==2.0.22
python-coveralls==2.9.3
coveralls==1.11.1
coveralls==2.0.0
mock==4.0.2

# Version update
PyGithub==1.47
bumpversion==0.5.3
bumpversion==0.5.3
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ urllib3==1.25.8
patool==1.12

# configs
pyyaml==5.3
pyyaml==5.3.1

# Logs
daiquiri==2.1.1
Expand All @@ -12,4 +12,4 @@ daiquiri==2.1.1
guessit==3.1.0

# Emails
sendgrid==6.1.3
sendgrid==6.2.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name='tvsort_sl',
packages=['tvsort_sl'],
version='1.1.5',
version='1.1.6',
description='Sort movies and TV-shows files',
long_description=open('readme.md').read(),
long_description_content_type='text/markdown',
Expand Down
26 changes: 21 additions & 5 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
import time
from distutils.util import strtobool

import yaml
from github import Github
Expand Down Expand Up @@ -95,12 +96,27 @@ def mutmut(c):
@task()
def bump_version(c):
files_to_update = ['setup.py', '.bumpversion.cfg']
branch_name = 'develop'

github_client = Github(os.environ['GITHUB_ACCESS_TOKEN'])
repo = github_client.get_repo('shlomiLan/tvsort_sl')

pr = repo.get_pull(int(os.environ['TRAVIS_PULL_REQUEST']))
travis_pull_request = os.environ['TRAVIS_PULL_REQUEST']
travis_pull_request_branch = os.environ['TRAVIS_PULL_REQUEST_BRANCH']
travis_pull_request_slug = os.environ['TRAVIS_PULL_REQUEST_SLUG']

try:
travis_pull_request = int(travis_pull_request)
except ValueError:
travis_pull_request = strtobool(travis_pull_request)

if not travis_pull_request:
print('Not running on PR')
return

# Convert travis_pull_request from string to int
travis_pull_request = int(travis_pull_request)

repo = github_client.get_repo(travis_pull_request_slug)
pr = repo.get_pull(travis_pull_request)
for pr_file in pr.get_files():
pr_filename = pr_file.filename
if pr_filename in files_to_update:
Expand All @@ -114,7 +130,7 @@ def bump_version(c):
for filename in files_to_update:
# Separate commits so that Travis will only build the last one
time.sleep(10)
file_object = repo.get_contents(path=filename, ref=branch_name)
file_object = repo.get_contents(path=filename, ref=travis_pull_request_branch)
with open(filename) as f:
repo.update_file(file_object.path, "Update version, file: {}".format(filename), f.read(),
file_object.sha, branch=branch_name)
file_object.sha, branch=travis_pull_request_branch)

0 comments on commit 870927d

Please sign in to comment.