-
Notifications
You must be signed in to change notification settings - Fork 182
/
ci.sh
executable file
·60 lines (48 loc) · 2.1 KB
/
ci.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
#!/bin/bash
set -e
# You can run it from any directory.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_DIR="$DIR"
pushd "$PROJECT_DIR"
# Export "PUBLISH_RELEASE=true" to initiate release process.
if [ "$PUBLISH_RELEASE" != "true" ]; then
echo "Running non-release build...".
# For some reason test for annotation processor are failing on a regular CI setup.
# So we had to exclude test task for it from the main build process and execute it as a separate command.
./gradlew clean build checkstyle -PdisablePreDex --exclude-task :storio-sqlite-annotations-processor-test:test --exclude-task :storio-content-resolver-annotations-processor-test:test
./gradlew :storio-sqlite-annotations-processor-test:test
./gradlew :storio-content-resolver-annotations-processor-test:test
else
echo "Launching release publishing process..."
if [ -z "$GPG_SECRET_KEYS" ]; then
echo "Put base64 encoded gpg secret key for signing into GPG_SECRET_KEYS env variable."
exit 1
fi
if [ -z "$GPG_OWNERTRUST" ]; then
echo "Put base64 encoded gpg ownertrust for signing into GPG_OWNERTRUST env variable."
exit 1
fi
if [ -z "$GPG_KEY_ID" ]; then
echo "Put GPG key id into GPG_KEY_ID env variable."
exit 1
fi
if [ -z "$GPG_PASSPHRASE" ]; then
echo "Put GPG passphrase into GPG_PASSPHRASE env variable."
exit 1
fi
set +e
echo "$GPG_SECRET_KEYS" | base64 --decode | gpg --import
gpg_import_result=$?
set -e
# Code '2' means that keys were already in local keychain.
if [ "$gpg_import_result" == "0" ] || [ "$gpg_import_result" == "2" ]; then
echo "GPG keys imported successfully."
else
echo "Failed to import GPG keys."
exit 1
fi
echo 'Importing GPG ownertrust...'
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust;
echo 'GPG ownertrust imported successfully.'
./gradlew clean uploadArchives closeAndReleaseRepository -Psigning.keyId="$GPG_KEY_ID" -Psigning.password="$GPG_PASSPHRASE" -Psigning.secretKeyRingFile="$HOME/.gnupg/secring.gpg"
fi