Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload wheels to GitHub Releases #156

Merged
merged 3 commits into from
Aug 7, 2020

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jul 7, 2020

Fixes #146, using one of @mattip's suggestions.

Based on Cython's config:

Travis CI docs:

The wheels are only built for tags, and the workflow will change a bit so we'll need to update:

  • the main RELEASING.md checklist,
  • this README.md
  • and update-pillow-tag.sh.

When releasing, we add and push a tag. It builds as normal (and also skips the "latest" jobs, we don't need to build/deploy them). The wheels are uploaded to a matching tag release here in this repo.

We can then download the wheels from the release, and can twine upload with the separately-built Windows wheels, and source (this looks handy for downloading).

(We could delete the release/files from here if we wanted to ensure PyPI is the place to go, not sure if that's necessary.)

Here's an example:

diff --git a/update-pillow-tag.sh b/update-pillow-tag.sh
index a48d6ca..c3000f1 100755
--- a/update-pillow-tag.sh
+++ b/update-pillow-tag.sh
@@ -15,4 +15,5 @@ git fetch --all
 git checkout $1
 cd ..
 git commit -m "Pillow -> $1" Pillow
-git push
+git tag "$1"
+git push --tags

Note we'd still need a normal git push (without --tags), but that will do a normal build of latest and non-latest (and no wheels), so that could come in the post-release thing, to avoid eating up CI time.

I'll annotate some lines too with some extra info.

@hugovk hugovk mentioned this pull request Jul 7, 2020
- WHEELHOUSE_UPLOADER_USERNAME=travis-worker
# Following generated with
# travis encrypt -r python-pillow/pillow-wheels WHEELHOUSE_UPLOADER_SECRET=<the api key>
- secure: "ky76goiK6n4k8V9/uG340GSFVwmjE7G76l9xbhhGZkcph4eTwN5VRM/tqyJvlNs/HZOhKSILfyGBeaG8qf7gHmwr0touPT+EjWn4TNV8iyVj75ZshgRE9DuaIAfdH89gW2m+BmvBDyzi0JE3KVCu55NcGm8h7Ecl6nmQ/c2iROY="
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, no longer using wheelhouse_uploader.

@@ -110,17 +106,20 @@ jobs:
os: osx
osx_image: xcode9.3
language: generic
if: tag IS blank
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevent the latest jobs building for tag builds.

.travis.yml Outdated
@@ -219,16 +229,20 @@ install:
- if [[ -n "$LATEST" ]]; then BUILD_COMMIT=master; fi
- clean_code $REPO_DIR $BUILD_COMMIT
- build_wheel $REPO_DIR $PLAT
- ls -l "${TRAVIS_BUILD_DIR}/wheelhouse/"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For info to confirm a wheel was built.

deploy:
provider: releases
api_key:
secure: PTgVG7DrYa2FTSQOq0eDaHDZb1vy0vf6MulyuoXMg8rssPQgJ/mYxRpNDK4V0EKolpN7f8s/OGg+fpNNtp5pOCJGsx0Okcf+YB2ac+Xl7DQPBucbDKFXs1ndf/ny6umk0TXX8JTrDp/mJDJf401yx1+qsZ6X/PFvchXvXVrQ+SQ=
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an encrypted OAuth token created using travis setup releases on my account when inside a local checkout of the https://github.com/python-pillow/pillow-wheels/ repo (ie. not my fork).

https://docs.travis-ci.com/user/deployment/releases/#authenticating-with-an-oauth-token

provider: releases
api_key:
secure: PTgVG7DrYa2FTSQOq0eDaHDZb1vy0vf6MulyuoXMg8rssPQgJ/mYxRpNDK4V0EKolpN7f8s/OGg+fpNNtp5pOCJGsx0Okcf+YB2ac+Xl7DQPBucbDKFXs1ndf/ny6umk0TXX8JTrDp/mJDJf401yx1+qsZ6X/PFvchXvXVrQ+SQ=
file_glob: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can use *.whl in the next line.

file_glob: true
file: "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/*.whl"
on:
condition: -z "$LATEST"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant with if: tag IS blank, but a useful extra guard to make sure we don't build wheels for latest.

file: "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/*.whl"
on:
condition: -z "$LATEST"
repo: python-pillow/pillow-wheels
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure the deploy is only run from this repo.

on:
condition: -z "$LATEST"
repo: python-pillow/pillow-wheels
tags: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And only for tags.

condition: -z "$LATEST"
repo: python-pillow/pillow-wheels
tags: true
skip_cleanup: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, tell Travis not to delete all the files, including wheels, before deploy.

https://docs.travis-ci.com/user/deployment#uploading-files-and-skip_cleanup

@hugovk
Copy link
Member Author

hugovk commented Jul 7, 2020

And here's a test build on my fork (ignore the release is 7.2.1 and the files are 7.2.0, was just for test):

.travis.yml Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not upload to rackspace
2 participants