-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·25 lines (21 loc) · 902 Bytes
/
Copy pathpublish.sh
File metadata and controls
executable file
·25 lines (21 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
# Publish to Maven Central using credentials from the gitignored local.gradle.properties.
# Usage: ./publish.sh [publishToMavenCentral|publishAndReleaseToMavenCentral]
#
# Credentials are passed as -P flags so they never touch any tracked file and
# remain scoped to this project. See local.gradle.properties.example for the
# required keys.
set -e
PROPS_FILE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/local.gradle.properties"
if [ ! -f "$PROPS_FILE" ]; then
echo "Error: local.gradle.properties not found."
echo "Copy local.gradle.properties.example, fill in your credentials, then retry."
exit 1
fi
PARGS=()
while IFS= read -r line || [[ -n "$line" ]]; do
# Skip blank lines and comments
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
PARGS+=("-P${line}")
done < "$PROPS_FILE"
exec ./gradlew "${PARGS[@]}" "${@:-publishToMavenCentral}"