-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
26 lines (18 loc) · 915 Bytes
/
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
#!/usr/bin/env bash
set -eu
# Obviously a rough-draft for prototyping a more robust shell script for use in builds.
# Assumes it'll be run from this folder.
VERSION=`cat VERSION.md`
# Get just the 'patch' part
MAJOR=${VERSION%%.*}
PATCH_RAW=${VERSION##*.}
# Ensures there are three digits in PATCH, even if the first one or two must be zeros.
# If we're worried about overrun... uh... "just add more zeroes"?
printf -v PATCH "%03d" $PATCH_RAW
# Aims to ensure a monotonically-increasing build number.
BUILD_NUM="$MAJOR$PATCH"
# Note: obviously assumes that flutter's /bin folder is in the configured PATH.
# to build (for Android, on a Win machine... at least)
flutter build apk --build-name $VERSION --build-number $BUILD_NUM
# to test the command-line built version (for Android), verifying version info is properly set
# flutter run --use-application-binary build/app/outputs/apk/release/app-release.apk