xref: /aosp_15_r20/external/dagger2/util/deploy-to-maven-central.sh (revision f585d8a307d0621d6060bd7e80091fdcbf94fe27)
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
13$(dirname $0)/validate-dagger-version.sh "$VERSION_NAME"
14
15BAZEL_VERSION=$(bazel --version)
16if [[ $BAZEL_VERSION != *"5.3.2"* ]]; then
17  echo "Must use Bazel version 5.3.2"
18  exit 4
19fi
20
21if [[ -z "${ANDROID_HOME}" ]]; then
22  echo "ANDROID_HOME environment variable must be set"
23  exit 5
24fi
25
26bash $(dirname $0)/run-local-tests.sh
27
28bash $(dirname $0)/deploy-all.sh \
29  "gpg:sign-and-deploy-file" \
30  "$VERSION_NAME" \
31  "-DrepositoryId=sonatype-nexus-staging" \
32  "-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" \
33  "-Dgpg.keyname=${KEY}"
34
35# Note: we detach from head before making any sed changes to avoid commiting
36# a particular version to master.
37git checkout --detach
38bash $(dirname $0)/publish-tagged-release.sh $VERSION_NAME
39# Switch back to the original HEAD
40git checkout -
41
42bash $(dirname $0)/publish-tagged-docs.sh $VERSION_NAME
43