From 11a4e0a3aafef3957171b90adbbccadf31bc3f26 Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Fri, 15 Dec 2023 11:41:08 +0100 Subject: [PATCH] bump version --- .github/workflows/build-android.yml | 23 +++++++++++++++++------ .github/workflows/build-ios.yml | 3 +-- example/android/gradle.properties | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 2cba90a9..37206f82 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -63,13 +63,24 @@ jobs: PROJECT_ID: ${{ secrets.PROJECT_ID }} run: | # Get app version from file - FILE_VALUE=`cat $GITHUB_WORKSPACE/lib/version.dart` - VERSION=`echo $FILE_VALUE | sed "s/[^']*'\([^']*\)'.*/\1/"` - VNAME=`echo $VERSION | sed "s/+.*//"` - VBUILD=${VERSION#*+} + # Get app version from file + GRADLE_FILE=android/gradle.properties + VERSION_FILE=$GITHUB_WORKSPACE/lib/version.dart + + VERSION=`echo $(cat $VERSION_FILE) | sed "s/[^']*'\([^']*\)'.*/\1/"` + + # Set versionName on gradle.properties + awk -F"=" -v newval="$VERSION" 'BEGIN{OFS=FS} $1=="versionName"{$2=newval}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE + + # Increment versionCode (build number) on gradle.properties + awk -F"=" 'BEGIN{OFS=FS} $1=="versionCode"{$2=$2+1}1' $GRADLE_FILE > "$GRADLE_FILE.tmp" && mv "$GRADLE_FILE.tmp" $GRADLE_FILE + + # Get new versionCode + NEXT_BUILD=$(grep 'versionCode' $GRADLE_FILE | cut -d'=' -f2) - # Build ios app with flutter - flutter build apk --build-name $VNAME --build-number $VBUILD --dart-define="PROJECT_ID=$PROJECT_ID" --release + # Build Android app with flutter + flutter build apk --build-name $VERSION --build-number $NEXT_BUILD --dart-define="PROJECT_ID=$PROJECT_ID" --release + # Setup Node - name: Setup Node uses: actions/setup-node@v3 diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml index df6551ac..cb426416 100644 --- a/.github/workflows/build-ios.yml +++ b/.github/workflows/build-ios.yml @@ -1,6 +1,6 @@ name: Build iOS App -on: # workflow_dispatch +on: workflow_dispatch: release: types: [ published ] @@ -85,7 +85,6 @@ jobs: VERSION=`echo $FILE_VALUE | sed "s/[^']*'\([^']*\)'.*/\1/"` # Build ios app with flutter - # flutter build ios --dart-define="PROJECT_ID=$PROJECT_ID" --config-only --release flutter build ios --build-name $VERSION --dart-define="PROJECT_ID=$PROJECT_ID" --config-only --release cd ios diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a3..83470d9e 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true +versionName=3.0.2 +versionCode=10