Skip to content

Commit 8a9e8a1

Browse files
committed
Merge branch 'upload-latest-release-and-tweak-readme-how-to-make-a-release'
* upload-latest-release-and-tweak-readme-how-to-make-a-release: README: Improve "how to make a release ?" package: Upload packages to a pre-release named "latest"
2 parents df70a19 + a6f7667 commit 8a9e8a1

5 files changed

Lines changed: 109 additions & 12 deletions

File tree

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ install:
2929
script:
3030
- tox
3131

32+
deploy:
33+
- provider: script
34+
script: scripts/upload-latest-release.sh
35+
skip_cleanup: true
36+
on:
37+
repo: j0057/github-release
38+
branch: master
39+
3240
env:
3341
global:
34-
secure: "UmvFiDNU+3kc7Rc3xd/1LsIQx+qhF+Zb1GVxLtLJlBCGUQNX1Fb65sgZSJEEEbIXiM6pxKk3yWAa1bORJhqbhPKMex7y2pTEs8LR7kIyYLrJiMo/wd3jfQhwyJyoRMk8RntDt2dLA1iTRFfb7bjmxf8TAxCf8HgtV1R4ZEJSsdDW3afNjf1sPX7QRKToLWp80dWB9z/Co4LvMVakQiCQmmO7VowpSwSep33CzyHhB4Iy9Q6earakM7zt1kOI0+MTvooCKjvmVIvMI3FgUao2yM9lzORa2QRKifHmgjVkkbmNwBkjk9dgUpRpk/CocHJsSFKG4Pm/hHMjKg1gqNWVtzM1jiCRANEVsfA2er6879xdQr2d4xZ4RCnb/w39+/30+yuxr53x6+pW9qaz2AmqTm249CCjMkTyotXlX6TYQSb7wOiYGV2bQhXFIq5XCjRLlhEPUHWRbJ8QRPIP+aTqMaHY7TH7RDfV3hg09Twd1d361z+qIsTlahhWatffEjiQxIP63PiSTmCjNHm7MZcIdSf7kwOaPjvHSXXRieYZtNXP9v0wQ/pUK/ESPfgxq9RVcZKpWDQ5dToKCc4P8szL08DZU0p/QqK5F8EO1o3h0CzGbVRUsZPixmzJ9t2f2fFn8oTdPuvMak/L9QSGCaKSDtOnAyTuEVXfwMlzQoHbguc="
42+
secure: "BBMD+hloyqOsR/0Pac8WRpStkQDi+30ZZgnC4//Wiqpk82FdOfuVBMaQrTnCFeUaqLHBCDm5MMW58s7GjSn/zEPtHoNlvxpW9uV0CRub3pjs+2GsXNTh1gBuFzYohImhTZf1M2VzGT12NnjN0QYqFNoaDkihbC44q1+Mz/qtFDyHT92QgQ9TkbI9vrfJBDAKq5rQgIXqmZNJZGGFmk91XnNri4k4wddIHkZd+sVx398KaAbw8fEZoxLEGedTmKUrLexDB/4Hh1C2XMm+u6CrEou6p6Kk45jho31bEPSqDPcnWadPXsomQ1wr/n1TRxEQZfAxRm3irqshwz7DX8Yw/JLuBf3Y0Y/sqfwRwI8JbR8WuKyzSwclotcdj17FJgsKettyf4WsF/4UrqZKFG2MKrR49GQbOVmFtpDnfFYuZ/be0OptZHXhXKxj8Pbj5RaxvjzXDQVpPyOvWW9fZlGi1DhVsNsiSl4wQyV253P4Tax91mFRog1W4QOf8fkY8bVEU6hhqI8ApntDmXHlT5Ym1zXLqsk+U4maxXPC2NXATD6B778hRP906WCv6dqHVb5fwn06HftdfWrpWTa+Aww470IRbTvC1SSWa4zoD6kHX9rXtP4lEy7yA2E+I65dgY/Heq3ERIkVmjvjulks1HkQWqZeoe7nD58sSSwrxuaIbRo="

CHANGES.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ Testing
6363

6464
* Relocate test repositories under [github-release-bot](https://github.com/github-release-bot) user.
6565

66+
Build System
67+
------------
68+
69+
* Latest packages are now published
70+
71+
* Packages generated from master branch are available at https://github.com/j0057/github-release/releases/tag/latest
72+
73+
* They can be installed using `pip intall githubrelease -f https://github.com/j0057/github-release/releases/tag/latest`
74+
75+
Documentation
76+
-------------
77+
78+
* Update [maintainers: how to make a release ?](https://github.com/j0057/github-release/blob/master/README.md#maintainers-how-to-make-a-release-) section
79+
to include update of *CHANGES.md* and creation of a [github release](https://github.com/j0057/github-release/releases).
80+
6681
1.5.0
6782
=====
6883

@@ -180,8 +195,8 @@ Build System
180195
Documentation
181196
-------------
182197

183-
* Re-organize and improve [README.md](https://github.com/j0057/github-release/tree/add-changes-md#table-of-contents).
198+
* Re-organize and improve [README.md](https://github.com/j0057/github-release/blob/master/README.md#table-of-contents).
184199

185-
* Add [maintainers: how to make a release ?](https://github.com/j0057/github-release/tree/add-changes-md#maintainers-how-to-make-a-release-) section.
200+
* Add [maintainers: how to make a release ?](https://github.com/j0057/github-release/blob/master/README.md#maintainers-how-to-make-a-release-) section.
186201

187202
* Add [CONTRIBUTING](https://github.com/j0057/github-release/blob/master/CONTRIBUTING.md#contributing) guidelines.

README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,18 @@ Python, you should probably look into project like [github3py](http://github3py.
8080

8181
# installing
8282

83+
Released stable version can be installed from [pypi](https://pypi.python.org/pypi/githubrelease) using:
84+
8385
```bash
8486
pip install githubrelease
8587
```
8688

89+
Bleeding edge version can be installed using:
90+
91+
```bash
92+
pip intall githubrelease -f https://github.com/j0057/github-release/releases/tag/latest
93+
```
94+
8795
# configuring
8896

8997
First, [generate a new token](https://help.github.com/articles/creating-an-access-token-for-command-line-use). It
@@ -335,41 +343,62 @@ that has already been intercepted and recorded.
335343

336344
2. Make sure the cli and module work as expected
337345

338-
3. Tag the release. Requires a GPG key with signatures. For version *X.Y.Z*::
346+
3. Review [CHANGES.md](https://github.com/j0057/github-release/blob/master/README.md), replace *Next Release* into *X.Y.Z*, commit and push. Consider using `[ci skip]` in commit message.
347+
348+
4. Tag the release. Requires a GPG key with signatures. For version *X.Y.Z*:
339349

340350
```bash
341351
git tag -s -m "githubrelease X.Y.Z" X.Y.Z origin/master
342352
```
343353

344-
4. Create the source tarball and binary wheels::
354+
5. Create the source tarball and binary wheels:
345355

346356
```bash
347357
rm -rf dist/
348358
python setup.py sdist bdist_wheel
349359
```
350360

351-
5. Upload the packages to the testing PyPI instance::
361+
6. Upload the packages to the testing PyPI instance:
352362

353363
```bash
354364
twine upload --sign -r pypitest dist/*
355365
```
356366

357-
6. Check the [PyPI testing package page](https://testpypi.python.org/pypi/githubrelease/).
367+
7. Check the [PyPI testing package page](https://testpypi.python.org/pypi/githubrelease/).
358368

359-
7. Upload the packages to the PyPI instance::
369+
8. Upload the packages to the PyPI instance::
360370

361371
```bash
362372
twine upload --sign dist/*
363373
```
364374

365-
8. Check the [PyPI package page](https://pypi.python.org/pypi/githubrelease/).
375+
9. Check the [PyPI package page](https://pypi.python.org/pypi/githubrelease/).
366376

367-
9. Make sure the package can be installed::
377+
10. Create a virtual env, and make sure the package can be installed:
368378

369379
```bash
370-
mkvirtualenv test-pip-install
380+
mkvirtualenv test-githubrelease-install
371381
pip install githubrelease
372-
rmvirtualenv test-pip-install
382+
```
383+
384+
11. Create github release and upload packages:
385+
386+
```bash
387+
export GITHUB_TOKEN=YOUR_TOKEN
388+
githubrelease release j0057/github-release create X.Y.Z --name X.Y.Z --publish ./dist/*
389+
```
390+
391+
12. Update release notes by copying relevant content from CHANGES.md
392+
393+
```bash
394+
export EDITOR=vim
395+
githubrelease release j0057/github-release release-notes X.Y.Z
396+
```
397+
398+
13. Cleanup
399+
400+
```bash
401+
rmvirtualenv test-githubrelease-install
373402
```
374403

375404
# faq

scripts/upload-latest-release.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
if [[ "${TRAVIS}" == "true" ]] && [[ ${TRAVIS_PYTHON_VERSION} != "3.5.2" ]]; then
6+
echo "Skipping package on upload on Travis using python != 3.5.2 [TRAVIS_PYTHON_VERSION: ${TRAVIS_PYTHON_VERSION}]"
7+
exit 0
8+
fi
9+
10+
pip install .
11+
12+
REPO_NAME=j0057/github-release
13+
PRERELEASE_NAME=latest
14+
PACKAGE_DIR=./dist
15+
EXPECTED_PACKAGE_COUNT=2
16+
17+
release_date=$(date -u "+%Y-%m-%d at %0k:%M %Z")
18+
release_name="Latest (updated at ${release_date})"
19+
20+
# Check if packages have been generated
21+
packages=(${PACKAGE_DIR}/*)
22+
if [[ ${#packages[@]} -ne ${EXPECTED_PACKAGE_COUNT} ]]; then
23+
echo "Error: ${EXPECTED_PACKAGE_COUNT} packages are expected in ${PACKAGE_DIR}"
24+
ls ${PACKAGE_DIR}
25+
exit 1
26+
fi
27+
28+
# If needed, create release
29+
githubrelease --github-token ${GITHUB_UPLOAD_RELEASE_TOKEN} \
30+
release ${REPO_NAME} create --prerelease ${PRERELEASE_NAME} --name "${release_name}"
31+
32+
# Remove existing packages
33+
githubrelease --github-token ${GITHUB_UPLOAD_RELEASE_TOKEN} \
34+
asset ${REPO_NAME} delete ${PRERELEASE_NAME} "*"
35+
36+
# Upload latest packages
37+
githubrelease --github-token ${GITHUB_UPLOAD_RELEASE_TOKEN} \
38+
asset ${REPO_NAME} upload ${PRERELEASE_NAME} ${PACKAGE_DIR}/*
39+
40+
# Update release reference and name
41+
sha=$(git rev-parse HEAD)
42+
githubrelease --github-token ${GITHUB_UPLOAD_RELEASE_TOKEN} \
43+
release ${REPO_NAME} edit ${PRERELEASE_NAME} --target-commitish ${sha} --name "${release_name}"
44+

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ deps=
1010
commands=
1111
flake8
1212
py.test
13+
python setup.py sdist bdist_wheel

0 commit comments

Comments
 (0)