-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
65 lines (60 loc) · 2.33 KB
/
build.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
set -e
#set -x
# -v checks if a variable exists
# We want to be in the project root folder, not the scripts folder
if [[ "$(pwd)" == *"/Scripts" ]]; then
cd ..
fi
# get the Build Bumber & version from git
VERSION="$(cat VERSION)"
BUILD_NUMBER="$(git rev-list HEAD --count)"
# Gets the release tag from github if it exists (Github Actions)
# Assumes tags start with V
if [[ -v RELEASE_TAG ]] && [[ -n $RELEASE_TAG ]]; then
TAG="${RELEASE_TAG,,}"
VERSION="${TAG//"v"}"
fi
# Configure flutter & pre-build tasks
echo "::group::Configure tools"
flutter config --no-cli-animations --enable-analytics --color
dart pub global activate flutter_gen --color
dart pub global activate intl_translation --color
dart pub global activate build_runner --color
echo "::endgroup::"
echo "::group::Get Dependencies"
flutter pub get --color
echo "::endgroup::"
DEBUG=""
if [[ $GITHUB_EVENT_NAME == 'pull_request' ]]; then
DEBUG="--debug"
else
DEBUG="--release"
fi
echo "::group::Generate Translation Files"
dart pub global run --color intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/Frontend/intn_defs.dart lib/l10n/*.arb
echo "::endgroup::"
echo "::group::Generate Dart .g Files"
dart pub global run --color build_runner build --delete-conflicting-outputs
echo "::endgroup::"
if [[ ! -v SKIP_BUILD ]]; then # This is re-used for the linting job, which doesn't require a full build
# Build
if [[ $RUNNER_OS == 'macOS' ]]; then
echo doing nothing Awoo
#flutter build ipa $DEBUG --no-codesign --build-number="$BUILD_NUMBER" --build-name="$VERSION"
else
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
echo "$ANDROID_KEY_PROPERTIES" > ./android/key.properties
echo -n "$ANDROID_KEY_JKS" | base64 -d > ./android/AndroidKeystoreCodel1417.jks
fi
echo "::group::Build APK"
flutter build apk --split-debug-info=./symbols $DEBUG --build-number="$BUILD_NUMBER" --build-name="$VERSION" --color #--dart-define=cronetHttpNoPlay=true
echo "::endgroup::"
echo "::group::Build APK"
flutter build appbundle --split-debug-info=./symbols --build-number="$BUILD_NUMBER" --build-name="$VERSION" --color #--dart-define=cronetHttpNoPlay=true
echo "::endgroup::"
fi
if [[ -v GITHUB_OUTPUT ]]; then
echo "SENTRY_DIST=$BUILD_NUMBER" >> "$GITHUB_OUTPUT"
echo "SENTRY_RELEASE=$VERSION" >> "$GITHUB_OUTPUT"
fi
fi