Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitrise yml bump version #2535

Merged
merged 29 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
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
29 changes: 29 additions & 0 deletions .github/workflows/bump-version-name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bump version name
on:
# push:
# branches:
# - develop
pull_request:
branches:
- develop
- main
- bitrise_yml_new
types: [opened]
jobs:
bump-version-name:
runs-on: ubuntu-latest
if: contains(github.head_ref, "release/")
steps:
- uses: actions/checkout@v2
- name: Bump script
env:
HEAD_REF: ${{ github.head_ref }}
run: |
./scripts/bump-version.sh "$HEAD_REF"
git diff
git config user.name github-actions
git config user.email github-actions@github.com
git add bitrise.yml
git add package.json
git commit -m "Bump version name"
git push origin HEAD:"$HEAD_REF" --force
2 changes: 1 addition & 1 deletion bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ app:
PROJECT_LOCATION_IOS: ios
- opts:
is_expand: false
VERSION_NAME: "'2.1.1'"
VERSION_NAME: 2.2.0
- opts:
is_expand: false
ANDROID_APK_LINK: ''
Expand Down
36 changes: 36 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

versionName="$(awk '/VERSION_NAME: /{print $2}' bitrise.yml)"

MAJOR=$(awk -F. '{print $1}' <<< $versionName)
MINOR=$(awk -F. '{print $2}' <<< $versionName)
PATCH=$(awk -F. '{print $3}' <<< $versionName)
version=$MAJOR'.'$MINOR'.'$PATCH

if [[ $1 == *"release/"* ]] ; then
if [[ $1 == *"-major"* ]] ; then
major=$(($MAJOR + 1));
minor="0";
patch="0";
version=$major'.'$minor'.'$patch
elif [[ $1 == *"-minor"* ]] ; then
minor=$(($MINOR + 1));
patch="0";
version=$MAJOR'.'$minor'.'$patch
elif [[ $1 == *"-patch"* ]] ; then
patch=$(($PATCH + 1));
version=$MAJOR'.'$MINOR'.'$patch
fi

echo "Bumping versionName to"
echo $version

sed -i -e 's/VERSION_NAME: [0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}/VERSION_NAME: '$version'/' bitrise.yml
sed -i -e 's/"version": "[0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}"/"version": "'$version'"/' package.json

echo "Bumping versionName finished"
fi