From 1c111f732b18163c6523ed67dedc531bb617d927 Mon Sep 17 00:00:00 2001 From: Yogesh Choudhary Paliyal Date: Tue, 9 May 2023 23:24:57 +0530 Subject: [PATCH] script changes (#524) --- .github/workflows/master-apk-create.yml | 17 +++++++++++++++++ scripts/masterVersion.sh | 13 +++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 scripts/masterVersion.sh diff --git a/.github/workflows/master-apk-create.yml b/.github/workflows/master-apk-create.yml index 964814fe..ead60a54 100644 --- a/.github/workflows/master-apk-create.yml +++ b/.github/workflows/master-apk-create.yml @@ -25,6 +25,23 @@ jobs: - name: Build APK ⚙️🛠 run: bash ./gradlew assembleStagingDebug + + - name: 🏗 Master Bump App Version + id: bump-app-version + run: | + newVersion=$(bash ./scripts/masterVersion.sh) + echo "::newVersion::$newVersion" + echo "newVersion=$newVersion" >> "$GITHUB_OUTPUT" + env: + TYPE: ${{ inputs.type }} + RELEASE_NOTES: ${{ inputs.releaseNote }} + + - name: Git Add and Commit + run: | + git config --global user.name 'Yogesh Choudhary Paliyal' + git config --global user.email 'yogeshpaliyal@users.noreply.github.com' + git add . + git commit -am "Github Actions: App version Bumped to ${{ steps.bump-app-version.outputs.newVersion }}" - uses: "marvinpinto/action-automatic-releases@latest" with: diff --git a/scripts/masterVersion.sh b/scripts/masterVersion.sh new file mode 100644 index 00000000..66bbfb20 --- /dev/null +++ b/scripts/masterVersion.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Read the current versionCode and versionName from the build.gradle file +VERSION_NAME=$(grep "versionName" app/build.gradle | awk '{print $2}' | tr -d '\r''"') + + +NEW_VERSION_NAME="$VERSION_NAME-master" + +# Update the build.gradle file with the new versionCode and versionName values +sed -i "s/versionName \"$VERSION_NAME\"/versionName \"$NEW_VERSION_NAME\"/" app/build.gradle + +# Output the new versionCode and versionName values +echo "v$NEW_VERSION_NAME"