diff --git a/.github/workflows/version-bump.yaml b/.github/workflows/version-bump.yaml index 3a0a42bb..c4aa3701 100644 --- a/.github/workflows/version-bump.yaml +++ b/.github/workflows/version-bump.yaml @@ -22,24 +22,47 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Checkout - run: | - git checkout -b autoVersionBump + # - name: Checkout + # run: | + # git checkout -b autoVersionBump - name: 🏗 Bump App Version - run: ls && bash ./scripts/versionBump.sh $TYPE "$RELEASE_NOTES" + id: bump-app-version + run: | + newVersion=$(bash ./scripts/versionBump.sh $TYPE "$RELEASE_NOTES") + echo "::newVersion::$newVersion" + echo "newVersion=$newVersion" >> "$GITHUB_OUTPUT" env: TYPE: ${{ inputs.type }} RELEASE_NOTES: ${{ inputs.releaseNote }} - # - name: Version Bump - # run: | - # git config --global user.name 'Yogesh Choudhary Paliyal' - # git config --global user.email 'yogeshpaliyal@users.noreply.github.com' - # git commit -am "Automated version bump" - # git push + - 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 commit -am "Automated version bump" - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5.0.0 + - name: Print newVersion + run: echo "${{ steps.bump-app-version.outputs.newVersion }}" + + - name: Push to protected branch + uses: CasperWA/push-protected@v2 + with: + token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }} + branch: main + unprotect_reviews: true + + + - name: Create Release + uses: ncipollo/release-action@v1.12.0 + with: + tag: "${{ steps.bump-app-version.outputs.newVersion }}" + generateReleaseNotes: true + commit: "master" + discussionCategory: "Release feedbacks" + makeLatest: true + + # - name: Create Pull Request + # uses: peter-evans/create-pull-request@v5.0.0 diff --git a/scripts/versionBump.sh b/scripts/versionBump.sh index ecedc810..73c608f9 100644 --- a/scripts/versionBump.sh +++ b/scripts/versionBump.sh @@ -15,7 +15,7 @@ MAJOR=${VERSION_PARTS[0]} MINOR=${VERSION_PARTS[1]} PATCH=${VERSION_PARTS[2]} -echo "$VERSION_CODE" +#echo "$VERSION_CODE" # Increment the appropriate version number based on the input type case $INCREMENT_MODE in @@ -34,8 +34,8 @@ sed -i "s/versionCode $VERSION_CODE/versionCode $NEW_VERSION_CODE/" app/build.gr sed -i "s/versionName \"$VERSION_NAME\"/versionName \"$NEW_VERSION_NAME\"/" app/build.gradle # Output the new versionCode and versionName values -echo "New versionCode: $NEW_VERSION_CODE" -echo "New versionName: $NEW_VERSION_NAME" +#echo "New versionCode: $NEW_VERSION_CODE" +echo "v$NEW_VERSION_NAME" -echo "$RELEASE_NOTES" > whatsnew/whatsnew-en-US -echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/${NEW_VERSION_CODE}.txt +#echo "$RELEASE_NOTES" > whatsnew/whatsnew-en-US +#echo "$RELEASE_NOTES" > fastlane/metadata/android/en-US/changelogs/${NEW_VERSION_CODE}.txt