-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathci
executable file
·91 lines (83 loc) · 3.3 KB
/
ci
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# Ref: https://stackoverflow.com/a/19622569
set -e
command_name="$1"
case $command_name in
build)
[ -n "${SIGNING_KEY_ID}" ] || (echo "::error:: SIGNING_KEY_ID env variable not set" && exit 1)
[ -n "${SIGNING_KEY_PASSWORD}" ] || (echo "::error:: SIGNING_KEY_PASSWORD env variable not set" && exit 1)
[ -n "${SIGNING_KEY_FILE}" ] || (echo "::error:: SIGNING_KEY_FILE env variable not set" && exit 1)
# assemble build
./gradlew --stacktrace assemble
;;
lint)
./gradlew clean lint
;;
unit_tests)
./gradlew --stacktrace testRelease
;;
integration_tests)
./gradlew --continue connectedAndroidTest
;;
publish_to_maven_local)
./gradlew clean publishToMavenLocal
;;
update_version)
# guard against version updates when CHANGELOG doesn't contain an unreleased section
grep "## unreleased" CHANGELOG.md || (echo "::error::No unreleased section found in CHANGELOG" && exit 1)
new_version="$2"
./gradlew -PversionParam="${new_version}" changeGradleReleaseVersion
./gradlew -PversionParam="${new_version}" changeREADMEVersion
./gradlew -PversionParam="${new_version}" changeMigrationGuideVersion
./gradlew -PversionParam="${new_version}" updateCHANGELOGVersion
;;
increment_snapshot_version)
new_version="$2"
./gradlew -PversionParam="${new_version}" incrementSNAPSHOTVersion
;;
increment_demo_app_version_code)
./gradlew incrementVersionCode
;;
publish)
# Ref: https://nickjanetakis.com/blog/prevent-unset-variables-in-your-shell-bash-scripts-with-set-nounset
[ -n "${SONATYPE_NEXUS_USERNAME}" ] || (echo "::error:: SONATYPE_NEXUS_USERNAME env variable not set" && exit 1)
[ -n "${SONATYPE_NEXUS_PASSWORD}" ] || (echo "::error:: SONATYPE_NEXUS_PASSWORD env variable not set" && exit 1)
[ -n "${SIGNING_KEY_ID}" ] || (echo "::error:: SIGNING_KEY_ID env variable not set" && exit 1)
[ -n "${SIGNING_KEY_PASSWORD}" ] || (echo "::error:: SIGNING_KEY_PASSWORD env variable not set" && exit 1)
[ -n "${SIGNING_KEY_FILE}" ] || (echo "::error:: SIGNING_KEY_FILE env variable not set" && exit 1)
release_type="$2"
if [ "${release_type}" == "release" ]; then
# publish release
./gradlew --stacktrace clean :browser-switch:publishToSonatype closeAndReleaseSonatypeStagingRepository
else
# publish SNAPSHOT
./gradlew --stacktrace clean :browser-switch:publishToSonatype
fi
;;
decode_signing_key)
[ -n "${SIGNING_KEY}" ] || (echo "::error:: SIGNING_KEY env variable not set" && exit 1)
[ -n "${SIGNING_KEY_FILE}" ] || (echo "::error:: SIGNING_KEY_FILE env variable not set" && exit 1)
# write signing key to a temporary file
echo "${SIGNING_KEY}" > ~/secretKey.gpg.b64
base64 -d ~/secretKey.gpg.b64 > "${SIGNING_KEY_FILE}"
;;
set_github_user_to_braintreeps)
git config user.name braintreeps
git config user.email [email protected]
;;
commit_and_tag_release)
new_version="$2"
git add -A
git commit -am "Release ${new_version}"
git tag "${new_version}" -a -m "Release ${new_version}"
;;
get_latest_changelog_entries)
sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md
;;
publish_dokka_docs)
./gradlew dokkaHtmlMultiModule
;;
android_lint)
./gradlew lint
;;
esac