Skip to content

Commit

Permalink
Chore: Update bump_version github action (#1032)
Browse files Browse the repository at this point in the history
* update bump_version github action

* fix naming

* remove default input
  • Loading branch information
anilbeesetti authored Aug 10, 2024
1 parent 34318f4 commit 7b66667
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Update version code, version name and open pull request
on:
push:
branches:
- 'release/v*.*.*'
workflow_dispatch:
inputs:
version:
description: "Version number (must be in x.y.z format)"
required: true

jobs:
bump-version-and-open-pr:
Expand All @@ -13,8 +15,8 @@ jobs:

- name: Get updated version name and version code
run: |
# Extract version number from branch name
version_name=${GITHUB_REF#refs/heads/release/v}
# Extract version name from github inputs
version_name="${{ github.event.inputs.version }}"
# Get existing version code from build.gradle
version_code=$(grep "versionCode" app/build.gradle.kts | awk '{print $3}' | tr -d '\n')
Expand All @@ -28,22 +30,15 @@ jobs:
- name: Update app/build.gradle.kts updated version name and version code
run: |
echo "Updating version code to ${{ env.VERSION_CODE }} and version name to ${{ env.version_name }}"
echo "Updating version code to ${{ env.VERSION_CODE }} and version name to ${{ env.VERSION_NAME }}"
sed -i "s/versionCode = [0-9]\+/versionCode = ${{ env.VERSION_CODE }}/g" app/build.gradle.kts
sed -i "s/versionName = \"[^\"]*\"/versionName = \"${{ env.VERSION_NAME }}\"/g" app/build.gradle.kts
- name: Commit and push changes
run: |
git config user.email "[email protected]"
git config user.name "Github Actions"
git commit -am "Bump version code and change version name"
git push origin HEAD
- name: Open pull request
uses: peter-evans/[email protected]
with:
commit-message: "Build: prepare for v${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }}) release"
branch: "${{ github.ref }}"
branch: "release/${{ github.event.inputs.version }}"
title: "Build: prepare for v${{ env.VERSION_NAME }} (${{ env.VERSION_CODE }}) release"
body: ""
base: "main"

0 comments on commit 7b66667

Please sign in to comment.