Skip to content

Commit

Permalink
More release fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
niamu committed Sep 25, 2015
1 parent f9f103e commit de2bca9
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 119 deletions.
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ install:
- mkdir -p $TRAVIS_BUILD_DIR/share/love/
env:
global:
- secure: "MA1+zHILO7O99n5+nj6jxuqVHUM0ZcGFfiZ9GT/4JyOG8nGkKWXopW/PbDzj\nRRFW3oknkm9jwVgCccvb2oSCPhEUVEUwcdo6xMuCFnskQNAA4q/SWAXXcZvm\nLjaJHNIb66Nnti+dhfAtfNvw8InzV7RzlmBxRrlH9M/0+X2gE5U="
- secure: "Ak9ffdd8c/3toP5hN+Y1YI0grtstT+pLcIyhYYUAKYnOZJNY+W+adSwIbT+D\n82KbHkntiBNZ6a5dPZ7j28bKAtIToNS0KHRqviqwpsPw8m2fJ1trbyBIuscF\nqLihmRq0ve+gWjJIDpTQh2BHTJ+9lHnDCGExkf8JCIrMK7lnU1w="
- secure: "trApdw22XK+5CuaDHnRnkp3qh2fRChaTSrH5mG+B+JCxpZMhT7pY98x6R/bj\nUOisRJODSxSveYWU5OgiG2YOk/LGxbc/YRRneNKUk9E+fiLySpT5dGCCrQgB\nnkM+vXOAr2wnW//0nZHC14caw5sc/yQJ6MLj1/6ofzvvffQbjNs="
- secure: "mp0ajWjr1kzxLdVb1wigp6ZzTQcpX9fU2WmplAjYTJnG4m58YZ3Ev+note9S\n0kfTyaQTJiUzbotxDXsUmBszCehnH7E8yP9PT1eli7bJS+b23D5dYnfaAYKf\nvf8E0JFhIvMm8MDFFnrIOESmFUNDj/T0aDN/ASu1x0QLmjRfmlA="
- secure: "ZcTu/33tHOnBiXqYr5ea0V2njReiHYe1LeBze8C224tU/V0ZvUaohIcJkF2E\nCb+7kLnf+HLCJtiD3XbLz6XJuwJnh80/Oq+ItwBWdWcH/AccexRFb1QKTeMR\naJvuecZ2yUxib251DYzlHnxtd1S9+M63atYWmllDpd6tM5ISbuI="
- secure: "OvdZg49UKSQ5zW/w/3R1coa4iIe1YWseI/7hhpOvv3ABpouI8AbPtmWFH9Ed\nIq1jTDu4Epm4dXs/wXEjcN7CXq2n8NF+a5x8SBSxmopFtjbDeOgwSHwnTxWn\nDMo5psEfZNoqMMnYQNvq0IV2W/2FPFRsIOCCg6oxgLfAJfrzKOE="
- secure: "rKCTAsDVeJijQglX0E48Vuqrpmx9uawA4ciObTWQ9uWhsiCZR72jg4lgh9QM\nDhSiHDRBWqC2RzuZzN2IpxAnRug8FzSecYJ9oaXvnbYJXt55UkcIv6ano1d6\nPc/VXa5kRnA8ozO9pvCnPYzT/o7mOxG/l16LOqCblXMsZf2n0IE="
- XDG_DATA_HOME="$TRAVIS_BUILD_DIR/share"
script: make deploy
addons:
artifacts:
paths:
- ./build/hawkthorne-osx.zip
- ./build/hawkthorne-win-x86.zip
- ./build/hawkthorne.love
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ bin/love.app/Contents/MacOS/love:
# THE REST OF THESE TARGETS ARE FOR RELEASE AUTOMATION
######################################################

CI_TARGET=test validate maps
CI_TARGET=test validate maps productionize binaries

ifeq ($(TRAVIS), true)
ifeq ($(TRAVIS_PULL_REQUEST), false)
ifeq ($(TRAVIS_BRANCH), release)
CI_TARGET=clean test validate maps productionize upload appcast social
endif
ifeq ($(TRAVIS_BRANCH), master)
CI_TARGET=clean test validate maps productionize upload
CI_TARGET=clean test validate maps productionize upload social
endif
endif
endif
Expand Down Expand Up @@ -111,16 +108,15 @@ productionize: venv

binaries: build/hawkthorne-osx.zip build/hawkthorne-win-x86.zip

upload: binaries venv
venv/bin/python scripts/upload_binaries.py
upload: binaries post.md venv
venv/bin/python scripts/release.py

appcast: venv build/hawkthorne-osx.zip win32/hawkthorne.exe
venv/bin/python scripts/sparkle.py
cat sparkle/appcast.json | python -m json.tool > /dev/null
venv/bin/python scripts/upload.py / sparkle/appcast.json

social: venv post.md notes.html
venv/bin/python scripts/upload_release_notes.py
social: venv notes.html post.md
venv/bin/python scripts/socialize.py post.md

notes.html: post.md
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tweepy==2.3.0
requests==1.0.4
requests==2.7.0
jinja2==2.7.3
boto==2.8.0
boto==2.38.0
markdown==2.2.1
uritemplate.py==0.3.0
18 changes: 5 additions & 13 deletions scripts/create_post.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
import os
import sys
from datetime import datetime
import argparse
import boto
import requests
import jinja2
import json
import time
import subprocess

import version

pulls_url = "https://api.github.com/repos/hawkthorne/hawkthorne-journey/pulls"
compare_url = "https://github.com/hawkthorne/hawkthorne-journey/compare/{}...{}"
GITHUB_TIME = "%Y-%m-%dT%H:%M:%SZ"


def post_content():
resp = requests.get(pulls_url, params={'state': 'closed', 'base': 'release'})
resp = requests.get(pulls_url, params={
'state': 'closed',
'base': 'release'
})
pulls = resp.json()

if not pulls:
raise ValueError(('No pull request for this release, which means no'
'post'))

template = jinja2.Template(open('templates/post.md').read())
return template.render(pull=pulls[0], version=version.current_version())
return pulls[0]['body']


def commithash(version):
Expand Down
8 changes: 4 additions & 4 deletions scripts/productionize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def create_conf_json(version):
conf = json.load(open('src/config.json'))

if os.environ.get('TRAVIS_BRANCH', '') == 'master':
if os.environ.get('TRAVIS_BRANCH', '') != 'release':
return

conf.update({
Expand All @@ -35,10 +35,10 @@ def create_conf_lua(version):


def main():
if os.environ.get('TRAVIS_BRANCH', '') == 'master':
v = "0.0.0"
else:
if os.environ.get('TRAVIS_BRANCH', '') == 'release':
v = version.next_version()
else:
v = "0.0.0"

logging.info("Creating osx/Info.plist")
create_info_plist(v)
Expand Down
5 changes: 4 additions & 1 deletion scripts/socialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def update_twitter(version, post_url):
def update_reddit(title, post, community=False):
if 'TRAVIS' not in os.environ:
logging.info('[DRYRUN] Posting {}'.format(title))
logging.info(post)
return

r = Reddit(os.environ['BRITTA_BOT_USER'])
Expand Down Expand Up @@ -110,7 +111,9 @@ def main():
args = parser.parse_args()

v = version.current_version()
post = args.input.read()
body = args.input.read()
template = open('templates/post.md').read()
post = template.format(body=body, version=v)

post_url = update_reddit(title.format(v), post,
community=version.is_release())
Expand Down
62 changes: 0 additions & 62 deletions scripts/upload_binaries.py

This file was deleted.

31 changes: 16 additions & 15 deletions scripts/version.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
"""
Bump the version number
"""
import os
import boto
import argparse
import requests
import json

s3 = boto.connect_s3()


def current_version():
x, y, z = current_version_tuple()
return "{0}.{1}.{2}".format(x,y,z)
return "{0}.{1}.{2}".format(x, y, z)


def next_bugfix_version():
x, y, z = current_version_tuple()
return "{0}.{1}.{2}".format(x,y,int(z) + 1)
return "{0}.{1}.{2}".format(x, y, int(z) + 1)


def next_minor_version():
x, y, z = current_version_tuple()
return "{0}.{1}.0".format(x,int(y)+1)
return "{0}.{1}.0".format(x, int(y)+1)


def next_major_version():
x, y, z = current_version_tuple()
return "{0}.0.0".format(int(x)+1)


def next_version():
if is_major():
return next_major_version()
Expand All @@ -39,20 +39,20 @@ def next_version():

def prev_version():
x, y, z = current_version_tuple()
return "{0}.{1}.{2}".format(x,y,int(z) - 1)
return "{0}.{1}.{2}".format(x, y, int(z) - 1)


def current_version_tuple():
bucket = s3.get_bucket("files.projecthawkthorne.com", validate=False)
key = bucket.get_key("releases/latest/hawkthorne-osx.zip")
redirect = key.get_redirect()
_, _, version, _ = redirect.split('/')
return tuple(version.replace('v', '').split('.'))
url = ("https://api.github.com/repos/hawkthorne/"
"hawkthorne-journey/releases/latest")
resp = requests.get(url)
tag_name = resp.json()['tag_name']
return tuple(tag_name.replace('v', '').split('.'))


def is_release():
pulls_url = "https://api.github.com/repos/hawkthorne/hawkthorne-journey/pulls"
resp = requests.get(pulls_url, params={'state': 'closed', 'base': 'release'})
url = "https://api.github.com/repos/hawkthorne/hawkthorne-journey/pulls"
resp = requests.get(url, params={'state': 'closed', 'base': 'release'})

if not resp.ok:
return False
Expand All @@ -64,9 +64,10 @@ def is_release():

return 'release' in pulls[0].get('title', '').lower()


def is_major():
pulls_url = "https://api.github.com/repos/hawkthorne/hawkthorne-journey/pulls"
resp = requests.get(pulls_url, params={'state': 'closed', 'base': 'release'})
url = "https://api.github.com/repos/hawkthorne/hawkthorne-journey/pulls"
resp = requests.get(url, params={'state': 'closed', 'base': 'release'})

if not resp.ok:
return False
Expand Down
10 changes: 4 additions & 6 deletions templates/post.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ pull.body }}
{body}

**DOWNLOAD**

- [OS X](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne-osx.zip)
- [Windows](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne-win-x86.zip)
- [hawkthorne.love](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne.love)
- [OS X](http://files.projecthawkthorne.com/releases/v{version}/hawkthorne-osx.zip)
- [Windows](http://files.projecthawkthorne.com/releases/v{version}/hawkthorne-win-x86.zip)
- [hawkthorne.love](http://files.projecthawkthorne.com/releases/v{version}/hawkthorne.love)
You'll need to install the [love](http://love2d.org) framework as well.

**How can I help?**
Expand All @@ -14,5 +14,3 @@
- [Record music and sound effects](https://github.com/hawkthorne/hawkthorne-journey/blob/master/CONTRIBUTING.md#music-and-sound-effects)
- [Draw sprites and tile sets](https://github.com/hawkthorne/hawkthorne-journey/blob/master/CONTRIBUTING.md#sprites)
- [Create new costumes and characters](https://github.com/hawkthorne/hawkthorne-journey/blob/master/CONTRIBUTING.md#characters-and-costumes)

[Full CHANGELOG on GitHub]({{pull.html_url}})

0 comments on commit de2bca9

Please sign in to comment.