@@ -155,14 +155,13 @@ workflows:
155155 ./gradlew clean test --no-daemon
156156 - name : Setup Gradle and Build RIA DigiDoc
157157 script : |
158+ # Get latest build numbers from "internal" and "production" tracks
158159 LATEST_GOOGLE_PLAY_INTERNAL_BUILD_NUMBER=$(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks internal)
159160 LATEST_GOOGLE_PLAY_PRODUCTION_BUILD_NUMBER=$(google-play get-latest-build-number --package-name "$PACKAGE_NAME" --tracks production)
160161
161- echo "Internal Build Number: $INTERNAL_BUILD_NUMBER"
162- echo "Release Build Number: $RELEASE_BUILD_NUMBER"
163-
164162 # Check that both tracks have valid build numbers (over 0) and select the highest.
165163 # Add +1 to the highest build number to submit to Google Play
164+ # If any are 0, use build number
166165 if [ "$LATEST_GOOGLE_PLAY_INTERNAL_BUILD_NUMBER" -gt 0 ] && [ "$LATEST_GOOGLE_PLAY_PRODUCTION_BUILD_NUMBER" -gt 0 ]; then
167166 if [ "$LATEST_GOOGLE_PLAY_INTERNAL_BUILD_NUMBER" -gt "$LATEST_GOOGLE_PLAY_PRODUCTION_BUILD_NUMBER" ]; then
168167 LATEST_BUILD_NUMBER=$(($LATEST_GOOGLE_PLAY_INTERNAL_BUILD_NUMBER + 1))
@@ -173,14 +172,15 @@ workflows:
173172 echo "Release build number is highest, new build number for this build: $LATEST_BUILD_NUMBER"
174173 echo LATEST_BUILD_NUMBER=$LATEST_BUILD_NUMBER >> $CM_ENV
175174 fi
176- else
175+ else
177176 echo "One or both build numbers are 0, using build number"
178177 LATEST_BUILD_NUMBER="$APP_VERSION_NAME.$PROJECT_BUILD_NUMBER"
179178 fi
180179
181180 # Make latest build number be available in all build steps
182- echo APP_VERSION=$APP_VERSION_NAME.$LATEST_BUILD_NUMBER >> $CM_ENV
183- echo $APP_VERSION
181+ APP_VERSION="$APP_VERSION_NAME.$LATEST_BUILD_NUMBER"
182+ echo "APP_VERSION=$APP_VERSION" >> $CM_ENV
183+ echo "Using app version: $APP_VERSION"
184184
185185 # Build app
186186 ./gradlew clean --no-daemon fetchAndPackageDefaultConfiguration -PappVersionName=$APP_VERSION -PappVersionCode=$LATEST_BUILD_NUMBER assembleRelease
0 commit comments