Skip to content

Commit c7824f1

Browse files
authored
Merge pull request #248 from rca/release-env
Improved release process and release of 1.6.4
2 parents ec2d9ef + a6f54c2 commit c7824f1

File tree

7 files changed

+447
-13
lines changed

7 files changed

+447
-13
lines changed

Pipfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[[source]]
2+
url = "https://pypi.python.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
"asn1crypto" = "==0.22.0"
9+
bcrypt = "==3.1.3"
10+
certifi = "==2017.7.27.1"
11+
cffi = "==1.10.0"
12+
chardet = "==3.0.4"
13+
cryptography = "==2.0.3"
14+
"enum34" = "==1.1.6"
15+
fabric = "==1.14.0"
16+
"github3.py" = "==0.9.6"
17+
idna = "==2.6"
18+
ipaddress = "==1.0.18"
19+
paramiko = "==2.2.1"
20+
"pyasn1" = "==0.3.3"
21+
pycparser = "==2.18"
22+
pynacl = "==1.1.2"
23+
pystache = "==0.5.4"
24+
requests = "==2.18.4"
25+
uritemplate = "==3.0.0"
26+
"uritemplate.py" = "==3.0.2"
27+
"urllib3" = "==1.22"
28+
sh = "*"
29+
30+
31+
[dev-packages]

Pipfile.lock

Lines changed: 319 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,36 @@ $ brew cask install shiftit
9797

9898
### Making a release
9999

100+
First, update the release version in [ShiftIt/ShiftIt-Info.plist](ShiftIt/ShiftIt-Info.plist).
101+
100102
Releases are handled using [fabric](http://docs.fabfile.org/en/1.5/). There are some dependencies that can be easily obtained using `pip`:
101103

102104
* [fabric](http://docs.fabfile.org/en/1.5/) - the build system itself
103105
* [github3](https://github.com/sigmavirus24/github3.py) - library for GitHub 3 API
104106
* [pystache](https://github.com/defunkt/pystache) - templates
105107

108+
NOTE: this is Python2 compatible; it will error out under Python3.
109+
110+
Using [pipenv](https://docs.pipenv.org/), a release environment
111+
can be created with the following command:
112+
```
113+
$ pipenv install --two
114+
$ pipenv shell
115+
```
116+
117+
Prior to running the commands below, ensure the following environment variables are set:
118+
119+
```
120+
export SHIFTIT_PRIVATE_KEY=~/.shiftit/dsa_priv.pem.gpg # get this from the project contributors
121+
export SHIFTIT_GITHUB_TOKEN=~/.shiftit/github.token.gpg # this is your personal access token
122+
export SHIFTIT_GITHUB_USER=fikovnik
123+
export SHIFTIT_GITHUB_REPO=ShiftIt
124+
```
125+
126+
Get your personal access token from [Github's developer settings page](https://github.com/settings/tokens).
127+
128+
As you see above, the private key and github token can be gpg-encrypted at rest. This is optional and they can simply be plain text; just don't suffix the files with `.gpg`.
129+
106130
The releases are fully automatic which hopefully will help to release more often.
107131

108132
**Available commands**

ShiftIt/ShiftIt-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.6.3</string>
20+
<string>1.6.4</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>1.6.3</string>
24+
<string>1.6.4</string>
2525
<key>LSApplicationCategoryType</key>
2626
<string>public.app-category.utilities</string>
2727
<key>LSMinimumSystemVersion</key>

fabfile.py

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,56 @@
11
################################################################################
22
## Configuration
33
################################################################################
4+
import os
5+
import tempfile
6+
7+
try:
8+
import sh
9+
10+
gpg = sh.Command('gpg')
11+
except ImportError as exc:
12+
def gpg(*args, **kwargs):
13+
raise NotImplementedError('the sh module is not installed; unable to use gpg-encrypted keys')
14+
15+
16+
class DecryptedFiles(object):
17+
tempfiles = []
18+
19+
@classmethod
20+
def get_decrypted_key_path(cls, path):
21+
"""
22+
Returns the path to a decrypted key
23+
24+
When the given path ends with `.gpg`, the file will be decrypted into a temporary file.
25+
26+
Args:
27+
path (str): path to the decrypted key
28+
29+
Returns:
30+
str: the path to a decrypted key
31+
"""
32+
if not path.endswith('.gpg'):
33+
return path
34+
35+
fh = tempfile.NamedTemporaryFile()
36+
cls.tempfiles.append(fh)
37+
38+
result = gpg('-d', path)
39+
40+
fh.write(result.stdout)
41+
fh.flush()
42+
43+
return fh.name
44+
45+
SHIFTIT_GITHUB_USER = os.environ['SHIFTIT_GITHUB_USER']
46+
SHIFTIT_GITHUB_REPO = os.environ['SHIFTIT_GITHUB_REPO']
447

548
proj_name = 'ShiftIt'
649
proj_info_plist = 'ShiftIt-Info.plist'
750
proj_src_dir = 'ShiftIt'
8-
proj_private_key = '/Users/krikava/Dropbox/Personal/Keys/ShiftIt/dsa_priv.pem'
9-
proj_github_token_file = '/Users/krikava/Dropbox/Personal/Keys/ShiftIt/github.token'
51+
52+
proj_private_key = DecryptedFiles.get_decrypted_key_path(os.environ.get('SHIFTIT_PRIVATE_KEY', '/Users/krikava/Dropbox/Personal/Keys/ShiftIt/dsa_priv.pem'))
53+
proj_github_token_file = DecryptedFiles.get_decrypted_key_path(os.environ.get('SHIFTIT_GITHUB_TOKEN', '/Users/krikava/Dropbox/Personal/Keys/ShiftIt/github.token'))
1054

1155
release_notes_template_html = '''
1256
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
@@ -67,7 +111,6 @@
67111
from fabric.colors import green
68112
from xml.etree import ElementTree
69113

70-
import os
71114
import pystache
72115
import github3
73116
import tempfile
@@ -80,9 +123,9 @@
80123

81124
def _find(f, seq):
82125
"""Return first item in sequence where f(item) == True."""
83-
126+
84127
for item in seq:
85-
if f(item):
128+
if f(item):
86129
return item
87130

88131
def _get_bundle_version(info_plist):
@@ -109,7 +152,7 @@ def _convert(i):
109152
closed_issues = list(shiftit.iter_issues(milestone=milestone.number, state='closed'))
110153
closed_issues.sort(key=lambda i: i.closed_at)
111154

112-
release_notes = dict(
155+
release_notes = dict(
113156
has_issues = len(closed_issues) > 0,
114157
issues = closed_issues,
115158
proj_name=proj_name,
@@ -148,7 +191,7 @@ def _load_github_token():
148191
################################################################################
149192

150193
github = github3.login(token=proj_github_token)
151-
shiftit = github.repository('fikovnik','ShiftIt')
194+
shiftit = github.repository(SHIFTIT_GITHUB_USER, SHIFTIT_GITHUB_REPO)
152195

153196
################################################################################
154197
## Tasks

release/appcast.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<link>https://raw.github.com/fikovnik/ShiftIt/master/release/appcast.xml</link>
66
<language>en</language>
77
<item>
8-
<title>ShiftIt version 1.6.3</title>
8+
<title>ShiftIt version 1.6.4</title>
99
<sparkle:releaseNotesLink>
10-
http://htmlpreview.github.com/?https://raw.github.com/fikovnik/ShiftIt/master/release/release-notes-1.6.3.html
10+
http://htmlpreview.github.com/?https://raw.github.com/fikovnik/ShiftIt/master/release/release-notes-1.6.4.html
1111
</sparkle:releaseNotesLink>
12-
<pubDate>Mon, 27 Apr 2015 23:58:28 </pubDate>
13-
<enclosure url="https://github.com/fikovnik/ShiftIt/releases/download/version-1.6.3/ShiftIt-1.6.3.zip" sparkle:version="1.6.3" length="814886" type="application/octet-stream" sparkle:dsaSignature="MC0CFQDJWnZVEbueK4PU3Nd8ReaDWAIEegIUOgsXqGsCrYsVX/LZXYMIw0NdyxM=" />
12+
<pubDate>Sat, 02 Dec 2017 22:07:50 </pubDate>
13+
<enclosure url="https://github.com/fikovnik/ShiftIt/releases/download/version-1.6.4/ShiftIt-1.6.4.zip" sparkle:version="1.6.4" length="830859" type="application/octet-stream" sparkle:dsaSignature="MC0CFQCC2f0LsxZQLW5J3H0iKzbk0nfolQIUNoH3LL2VdLaSwRaPXnT/iZwUJKo=" />
1414
</item>
1515
</channel>
1616
</rss>

release/release-notes-1.6.4.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2+
<html>
3+
<body>
4+
<h1>ShiftIt version 1.6.4</h1>
5+
6+
<h2>Issues closed</h2>
7+
<ul>
8+
<li><a href="https://github.com/fikovnik/ShiftIt/pull/169"><b>#169</b></a> - Add 10.8 fallback conditions (Issue #166)</li>
9+
<li><a href="https://github.com/fikovnik/ShiftIt/issues/166"><b>#166</b></a> - Text showing up in Japanese</li>
10+
<li><a href="https://github.com/fikovnik/ShiftIt/issues/170"><b>#170</b></a> - 'Authorization Required' screen even after enabling access for assistive devices</li>
11+
</ul>
12+
13+
More information about this release can be found on <a href="https://github.com/fikovnik/ShiftIt/issues?milestone=6">github</a>.
14+
<br/><br/>
15+
If you find any bugs please report them on <a href="http://github.com/fikovnik/ShiftIt/issues">github</a>.
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)