From a20cc4072fdefe3cbca90a1e4ecc911e3072a926 Mon Sep 17 00:00:00 2001 From: Delyan Kratunov Date: Thu, 30 Nov 2017 20:59:23 -0800 Subject: [PATCH] Assign releases to the right commit Summary: This was a tough one. It took about 20 builds and reading the github docs to figure out wtf is going on. 1) Travis needs a tag to even start the deployment. 2) Adding a tag to the local Travis checkout works fine. 3) However, upon receipt of the Travis request to create a new release, Github, not being aware of this tag (since Travis can't push it to github), defaults to creating it on master. Wherever master is pointing right now. The fix is to specify the `target_commitish` argument explicitly. Separately, we create a better name for the tag - something like `release-` rather than the mess travis generates. Also, let's disable email notifications for successful builds while we're here. Also-also, let's not start the build again once github pushes the tag, that's silly. Differential Revision: D6456285 Ninja: oss build stuff fbshipit-source-id: 3318d0c2a24ee21dc73d2ab0ce81b6b1896b5375 --- .travis.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4fdedf85a..c12011309 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,23 @@ script: - docker run -t loom:16.10 /usr/bin/env TERM=dumb bash /repo/build/build.sh - build/copy_artifacts_to_host.sh +before_deploy: +- export TRAVIS_TAG="release-$(git rev-parse --short ${TRAVIS_COMMIT})" +- echo "$TRAVIS_TAG" "$TRAVIS_COMMIT" +- git config --local user.name "Facebook Community Bot" +- git config --local user.email "nobody@nobody.com" +- git tag "$TRAVIS_TAG" "$TRAVIS_COMMIT" + deploy: provider: releases + tag_name: $TRAVIS_TAG + + # This is important as the tag doesn't exist in the remote repo yet. GitHub needs to know where to create it. + # If we don't specify the target explicitly, github will create the tag at + # the tip of master, which is obviously incorrect. + target_commitish: $TRAVIS_COMMIT + + overwrite: true skip_cleanup: true api_key: secure: Ty7ZRmeLcor3Ljlnk2eeBhiYouJG/dnjCDbMBBrMD25m/+VmU7XC+C0Ch4gKVqAdHyzUQVOrtNep3e+28D9Nze6I9oAJqIRkaND+Ogq05rwpftKBNKpfdL4+IXg3uLcXVFTbKBKJ/KSTNZcp0uxHZTxiquiIGFt7EKEQDNldwWIJeFzUHePLs/+orBskzVxH7iq+gZItNuyUjbaosmZQ5NW/zjJJkf7Ss0EEZjLtudCbA2wjfJgYLwRsdWbeRo0yzAW49mTI4MDnZnS4ltSViILs6Yjby1GTWKMxD8EXqjHZTqeNRgTW631qnou6EMmLBBTWl8NTPTsm1MmA5ncy9WfyPL92DfGuQ/0KMjXvJNYsWR4/4tBrxVtd0U7WX8v7xN75jtrOI/k8B2F+RHADESdk9AwA+0WipFw+9YHaHxi9alqoNImlFFvMpSHr3WrE7//6+1hMJ4iPMm/cqy5QUjO+3tVB+jvZZNkDYdtOt3p3cw3IAf4FFrZp4HPHGYGiw+tb1ZfPT0d+AZBSMKV5JJgegLEVbZ1h4agMX/09Qt6iXHeA0FvdfcAH3XHgaZZyNI5W/YIVLTTCGpB6G60LJ3ZA2iZOyWVaaH52iWe5a3u1YcImSwchgn3gOdl2iGCT+b6VjluNB9HGCpQSI9/4Nl1AuGdWkkJfd3hMWXtk1Co= @@ -22,3 +37,7 @@ deploy: on: all_branches: true repo: facebookexternal/loom + +branches: + except: + - /^release-[0-9a-z\-]*/