-
-
Notifications
You must be signed in to change notification settings - Fork 157
/
deploy_playstore.sh
executable file
·74 lines (63 loc) · 2.28 KB
/
deploy_playstore.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
#!/bin/bash -eu
LATEST_TAG="$(git describe --tags "$(git rev-list --tags --max-count=1)")"
CURRENT_VERSION="$(git describe --tags)"
if [ -n "${SERVICEACCOUNTJSON:-}" ]; then
cat > serviceaccount.b64 <<EOF
${SERVICEACCOUNTJSON}
EOF
fi
base64 --ignore-garbage --decode serviceaccount.b64 > serviceaccount.json
sed -i "s|/path/to/serviceaccount.json|$(pwd)/serviceaccount.json|" fastlane/Appfile
if [ -n "${KEYSTORE:-}" ]; then
cat > keystore.b64 <<EOF
${KEYSTORE}
EOF
base64 --ignore-garbage --decode keystore.b64 > keystore
cat >> gradle.properties <<EOF
STORE_FILE=$(pwd)/keystore
STORE_PASSWORD=${KEYSTOREPASSWORD}
KEY_ALIAS=${KEYALIAS}
KEY_PASSWORD=${KEYSTOREPASSWORD}
EOF
fi
# Delete unsupported google play store languages
rm -rf fastlane/metadata/android/bs-BA \
fastlane/metadata/android/eo \
fastlane/metadata/android/tok \
app/src/main/res/values-tok \
fastlane/metadata/android/gl \
app/src/main/res/values-gl \
fastlane/metadata/android/eu \
app/src/main/res/values-eu \
fastlane/metadata/android/vec \
app/src/main/res/values-vec \
fastlane/metadata/android/he \
app/src/main/res/values-he \
fastlane/metadata/android/is \
app/src/main/res/values-is
if [[ "${1:-}" == "--dry-run" ]] && [[ "${LATEST_TAG}" == "${CURRENT_VERSION}" ]]; then
echo "${CURRENT_VERSION} is a tag but --dry-run was specified - not doing anything"
elif [[ "${1:-}" == "--dry-run" ]] || [[ "${LATEST_TAG}" != "${CURRENT_VERSION}" ]]; then
echo "${CURRENT_VERSION} is not tag - validating deployment"
if [[ "${CURRENT_VERSION}" =~ ^[0-9.]*$ ]]; then
echo "${CURRENT_VERSION} is a production release"
fastlane build_and_validate track:production
else
echo "${CURRENT_VERSION} is a beta release"
# We don't have a beta track
# fastlane build_and_validate track:beta
fastlane build_and_validate track:production
fi
else
echo "${CURRENT_VERSION} is a tag - deploying to store!"
if [[ "${CURRENT_VERSION}" =~ ^[0-9.]*$ ]]; then
echo "${CURRENT_VERSION} is a production release"
fastlane build_and_deploy track:production
else
echo "${CURRENT_VERSION} is a beta release"
# We don't have a beta track
# fastlane build_and_deploy track:beta
fastlane build_and_validate track:production
fi
fi
git checkout app fastlane gradle.properties