This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.sh
executable file
·75 lines (62 loc) · 1.64 KB
/
publish.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
set -e
readonly local_release="local"
readonly portal_release="portal"
readonly release_mode="$1"
validate_release() {
echo
echo "🔥 Validating release ..."
echo
local portal_ready="yes"
if [[ -z "$TAG" ]]; then
echo " ‣ Could not detect 'TAG' environment variable"
echo " ‣ Release version will default to 'SNAPSHOT' according build conventions"
portal_ready="no"
echo
fi
if [[ -z "$API_KEY" ]]; then
echo " ‣ Could not detect 'API_KEY' environment variable"
portal_ready="no"
fi
if [[ -z "$API_SECRET" ]]; then
echo " ‣ Could not detect 'API_SECRET' environment variable"
portal_ready="no"
fi
if [[ "$portal_ready" == "no" && "$1" == "portal" ]]; then
echo
echo " ‣ Missing parameters required to publish on Gradle Plugins Portal"
echo " 𝙭 Aborting"
echo
exit 1
fi
echo
echo "🔥 Running publishing to : $release_mode"
echo
}
publish_to_maven_local() {
validate_release "$local_release"
./gradlew clean publishToMavenLocal -Ptag=$TAG
}
publish_to_gradle_portal() {
validate_release "$portal_release"
./gradlew clean publishPlugins \
-Pgradle.publish.key=$API_KEY \
-Pgradle.publish.secret=$API_SECRET \
-Ptag=$TAG \
--stacktrace
}
case "$release_mode" in
"$local_release")
publish_to_maven_local
;;
"$portal_release")
publish_to_gradle_portal
;;
*)
echo
echo "Error: unsupported release mode → $release_mode"
echo "Should pick one from : 'local' or 'portal'"
echo
exit 1
;;
esac