Skip to content

Instantly share code, notes, and snippets.

@mrtry
Last active May 23, 2021 10:49
Show Gist options
  • Save mrtry/8bd873f3f4629692d698c3c1f318b560 to your computer and use it in GitHub Desktop.
Save mrtry/8bd873f3f4629692d698c3c1f318b560 to your computer and use it in GitHub Desktop.
Bump version for react-native
#!/usr/bin/env bash
# branch名のチェック
if [[ $(git symbolic-ref --short HEAD) =~ '^release\/([0-9]+\.?){3}$' ]]; then
echo "Invalid branch name"
exit 1
fi
# Project rootに移動
cd $(git rev-parse --show-toplevel)
# branch名 release/xxx から xxx をとってくる
versionName=$(git symbolic-ref --short HEAD | sed 's/release\///')
# package.jsonまわりを更新
npm --no-git-tag-version version $versionName
# iOS
cd $(git rev-parse --show-toplevel)/ios
bundle exec fastlane run increment_build_number
bundle exec fastlane run increment_version_number version_number:"$versionName"
# Android
cd $(git rev-parse --show-toplevel)/android
bundle exec fastlane run increment_version_code app_project_dir:"app"
bundle exec fastlane run increment_version_name version_name:"$versionName"
# diffを確認
git add -u
git diff --cached
# project rootにおいて、android/ ios/ から参照してfastlaneのバージョンを共通化している
gem 'fastlane', '2.183.2'
# android/ ios/ に配置
source "https://rubygems.org"
fastlaneVersion = File.join(File.dirname(__FILE__), '../fastlane-version')
eval_gemfile(fastlaneVersion) if File.exist?(fastlaneVersion)
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!
# for Android
gem 'fastlane-plugin-android_versioning'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment