Skip to content

Commit

Permalink
Release v0.0.dev5
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-wilson committed Dec 9, 2020
1 parent 893ae7c commit bcabbf7
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sailboat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Workflow subs: [Sailboat,sailboat]
name: Publish system files for Sailboat.

on:
Expand Down
Binary file removed dist/pypi/sailboat-0.0.2.dev4-py3-none-any.whl
Binary file not shown.
Binary file removed dist/pypi/sailboat-0.0.2.dev4.tar.gz
Binary file not shown.
Binary file added dist/pypi/sailboat-0.0.dev5-py3-none-any.whl
Binary file not shown.
Binary file added dist/pypi/sailboat-0.0.dev5.tar.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion sailboat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ modules = [ "toml",]
fullname = "Sailboat"
homebrew = false
icon = ""
latest_build = "0.0.2dev4"
latest_build = "0.0.dev5"

[build]
type = "1"
Expand All @@ -24,3 +24,4 @@ windows = true
homebrew = false
actions = true
installer = false
actions_built_latest = false
5 changes: 5 additions & 0 deletions sailboat/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
with open('sailboat.toml') as file:
data = toml.loads(file.read())

try:
import wheel
except:
os.system('pip install wheel')

if sys.platform.startswith('win'):
sailboat.build.main(data['latest_build'],[],nointeraction=True)

Expand Down
18 changes: 16 additions & 2 deletions sailboat/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def main(version,arguments,nointeraction=False):
shutil.rmtree('dist')
except:
pass
os.system('python3 .'+os.sep+'setup.py sdist -d dist'+os.sep+'pypi bdist_wheel')
os.system('python3 .'+os.sep+'setup.py bdist_wheel sdist -d dist'+os.sep+'pypi')
try:
shutil.rmtree('build')
except:
Expand Down Expand Up @@ -189,12 +189,26 @@ def main(version,arguments,nointeraction=False):
print(f'Installer creation not yet supported for {sys.platform}!')
# ============== Generate Github Actions Workflow ===============================================
if doact:
# try:
oldact = open('.github'+os.sep+'workflows'+os.sep+'sailboat.yml').read().split('\n')[0]

# except:
# oldact = ''
try:
f = open('.github'+os.sep+'workflows'+os.sep+'sailboat.yml','w+')
except:
os.system('mkdir -p .github'+os.sep+'workflows'+os.sep)
f = open('.github'+os.sep+'workflows'+os.sep+'sailboat.yml','w+')
f.write(open(prefix+os.sep+'sailboat.yml.template').read().format(**data,version=version))
newdata = open(prefix+os.sep+'sailboat.yml.template').read().format(**data)
f.write(newdata)
# try:
# except:
# newact = ''
f.close()
newact = open('.github'+os.sep+'workflows'+os.sep+'sailboat.yml').read().split('\n')[0]
data['build']['actions_built_latest'] = newact != oldact
print(oldact)
print(newact)
# ============== Save Version ===============================================
print('saving version...')
data['latest_build'] = version
Expand Down
14 changes: 12 additions & 2 deletions sailboat/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,15 @@ def main(arguments,ids):
print('\u001b[4m\u001b[1;36mPyPi Credentials:\u001b[0m')
os.system('python3 -m twine upload dist'+os.sep+'pypi'+os.sep+'*'+' -c "'+data['build']['release_notes'].replace('\n',' / ').replace('"','`')+'"')
if "github" in ids or len(ids)==1:
f = f'git add .;git config --global credential.helper "cache --timeout=3600";git config user.name "{data["author"]}";git config user.email "{data["email"]}";git commit -m "Release v{version}";git commit --amend -m "Release v{version}";git tag v{version};git remote add origin https://github.com/{data["build"]["github"]}.git || echo;echo "\u001b[4m\u001b[1;36mGitHub Credentials: (will be cached for 1hr)\u001b[0m";git push origin master;git push origin master --tags;echo "Pushed twice to update workflow file first."'
os.system(f)
if data['build']['actions_built_latest']:
up = 'git push origin master;'
else:
up = ''
f = f'git add .;git config --global credential.helper "cache --timeout=3600";git config user.name "{data["author"]}";git config user.email "{data["email"]}";git commit -m "Release v{version}";git commit --amend -m "Release v{version}";git tag v{version};git remote add origin https://github.com/{data["build"]["github"]}.git || echo;echo "\u001b[4m\u001b[1;36mGitHub Credentials: (will be cached for 1hr)\u001b[0m";{up}git push origin master --tags;echo "--- done! ---"'
if up!="":
print('\n\nPushed twice to update workflow action before tagged push.')
os.system(f)
data['build']['actions_built_latest'] = False
f = open('.'+os.sep+'sailboat.toml','w+')
f.write(toml.dumps(data))
f.close()
1 change: 1 addition & 0 deletions sailboat/sailboat.yml.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Workflow subs: [{name},{short_name}]
name: Publish system files for {name}.

on:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setuptools.setup(
name="sailboat",
version="0.0.2dev4",
version="0.0.dev5",
scripts=['bin/sailboat'],
# entry_points={
# 'console_scripts': ['sailboat=sailboat.__main__'],
Expand Down

0 comments on commit bcabbf7

Please sign in to comment.