-
-
Save pauloantonelli/69b0c8202556f5569087027a84ffe1e8 to your computer and use it in GitHub Desktop.
Bash script to extract the build name and number from `pubspec.yaml` before building your Flutter app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
file=$(cat pubspec.yaml) | |
BUILD_NAME=$(echo $file | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') | |
BUILD_NUMBER=$(git rev-list HEAD --count) | |
echo "Building version ${BUILD_NAME} ${BUILD_NUMBER}" | |
export BUILD_NAME="$BUILD_NAME" | |
export BUILD_NUMBER="$BUILD_NUMBER" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment