Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Bomb Version'
on:
push:
branches:
- 'test/*'
- 'test/*.*.*'

workflow_dispatch:
inputs:
Expand All @@ -12,6 +12,7 @@ on:

jobs:
bump-version:
# if: ${{ github.event_name == 'push' && github.ref_name == 'master' || github.event.inputs.environment == 'PROD' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,11 +21,16 @@ jobs:
- name: Upgrade version
run: |
# Init
VERSION_INPUT=${{ github.event.inputs.targetVersionName }}
if [[ ! -z "${{ github.event.inputs.targetVersionName }}" ]] then
VERSION_INPUT=${{ github.event.inputs.targetVersionName }}
else
VERSION_INPUT=${GITHUB_REF#refs/heads/test/v}
fi

# Check validation with format "a.b.c-x"
rx='^([0-9]+\.){2,2}(\*|[0-9]+)(\-.*){0,1}$'
if [[ ! $VERSION_INPUT =~ $rx ]]; then
exit "Invalidate version"
exit "Invalidate version"
fi

# Parse input
Expand All @@ -33,19 +39,18 @@ jobs:
newPatch="$(echo VERSION_INPUT | cut -d'.' -f3)"
# newStaging="$(echo VERSION_INPUT | cut -d'-' -f2)" # check whether exist

echo "success"

# #Write file
# sed -i '' -E "s/versionMajor = ([0-9]+)/$newMajor/" build.gradle
#Write file
sed -i '' -E "s/versionName \"[^\"]*\"/versionName \"$VERSION_INPUT\"/g" app/build.gradle
# sed -i '' -E "s/versionName ([0-9]+)/$newMajor/" app/build.gradle
# sed -i '' -E "s/versionMinor = ([0-9]+)/$newMinor/" build.gradle
# sed -i '' -E "s/versionPatch = ([0-9]+)/$newPatch/" build.gradle
# # sed -i '' -E "s/versionStaging = ([0-9]+)/$newStaging/" build.gradle # check whether exist
# sed -i '' -E "s/versionStaging = ([0-9]+)/$newStaging/" build.gradle # check whether exist
#
# - name: Commit and push changes
# run: |
# git config user.email "github-actions@myfunnow.com"
# git config user.name "Github Actions"
# git commit -m "Change version name"
# git push origin HEAD
- name: Commit and push changes
run: |
git config user.email "github-actions@google.com"
git config user.name "Github Actions"
git commit -m "Change version name"
git push origin HEAD

# Push to firebase and slack