• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -eu
4
5if [ $# -lt 2 ]; then
6  echo "usage $0 <ssl-key> <version-name> [<param> ...]"
7  exit 1;
8fi
9readonly KEY=$1
10readonly VERSION_NAME=$2
11shift 2
12
13if [[ ! "$VERSION_NAME" =~ ^2\. ]]; then
14  echo 'Version name must begin with "2."'
15  exit 2
16fi
17
18if [[ "$VERSION_NAME" =~ " " ]]; then
19  echo "Version name must not have any spaces"
20  exit 3
21fi
22
23bash $(dirname $0)/run-local-tests.sh
24
25bash $(dirname $0)/deploy-dagger.sh \
26  "gpg:sign-and-deploy-file" \
27  "$VERSION_NAME" \
28  "-DrepositoryId=sonatype-nexus-staging" \
29  "-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" \
30  "-Dgpg.keyname=${KEY}"
31
32bash $(dirname $0)/deploy-hilt.sh \
33  "gpg:sign-and-deploy-file" \
34  "$VERSION_NAME" \
35  "-DrepositoryId=sonatype-nexus-staging" \
36  "-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" \
37  "-Dgpg.keyname=${KEY}"
38
39# Note: we detach from head before making any sed changes to avoid commiting
40# a particular version to master.
41git checkout --detach
42
43# Set the version string that is used as a tag in all of our libraries. If
44# another repo depends on a versioned tag of Dagger, their java_library.tags
45# should match the versioned release.
46sed -i s/'${project.version}'/"${VERSION_NAME}"/g build_defs.bzl
47
48# Note: We avoid commiting until after deploying in case deploying fails and
49# we need to run the script again.
50git commit -m "${VERSION_NAME} release" build_defs.bzl
51git tag -a -m "Dagger ${VERSION_NAME}" dagger-"${VERSION_NAME}"
52git push origin tag dagger-"${VERSION_NAME}"
53
54# Switch back to the original HEAD
55git checkout -
56
57# Publish javadocs to gh-pages
58bazel build //:user-docs.jar
59git clone --quiet --branch gh-pages \
60    https://github.com/google/dagger gh-pages > /dev/null
61cd gh-pages
62unzip ../bazel-bin/user-docs.jar -d api/$VERSION_NAME
63rm -rf api/$VERSION_NAME/META-INF/
64git add api/$VERSION_NAME
65git commit -m "$VERSION_NAME docs"
66git push origin gh-pages
67cd ..
68rm -rf gh-pages
69