1 #!/bin/sh 2 # 3 # Release automation script for Linux builds. This should be run 4 # first. Must be run from the top-level conscrypt directory. 5 6 set -e 7 8 if [ -z "$1" ]; then 9 echo "Usage: $0 <version>" 10 exit 1 11 fi 12 13 # Replace the last numerical component of the release with and x, so 14 # 1.2.3 becomes 1.2.x 15 BRANCH=$(echo "$1" | sed -E 's/([0-9]+[.][0-9]+[.])[0-9]+/\1x/') 16 17 git checkout "$BRANCH" 18 19 # Update the build.gradle file for the new version 20 sed -i 's/version = ".*"/version = "'"$1"'"/' build.gradle 21 22 # Commit the build.gradle, tag the release, and push upstream 23 git commit -a -m "Preparing version $1" 24 git tag -a "$1" -m "Version $1" 25 git push upstream "$BRANCH" 26 git push upstream "$1" 27 28 # Build and start the Docker container 29 CONTAINER_TAG="conscrypt-deploy-$1" 30 docker build -t $CONTAINER_TAG release 31 CONTAINER_ID=$(docker run -itd $CONTAINER_TAG) 32 33 # Copy the relevant files from the host machine into the container 34 docker exec $CONTAINER_ID mkdir /root/.gradle 35 docker cp ~/.gnupg $CONTAINER_ID:/root/ 36 docker cp ~/.gradle/gradle.properties $CONTAINER_ID:/root/.gradle/ 37 docker cp "$(grep signingKeystore ~/.gradle/gradle.properties | cut -d= -f2)" $CONTAINER_ID:/root/certkeystore 38 39 # Run the release automation script for the docker container 40 docker exec $CONTAINER_ID scl enable llvm-toolset-7 "/conscrypt/release/docker $1" 41