So, Capacitor is neat! The android and ios configs are actually committed to source control. To update version number, simply update the following files:
- Android -
android/app/build.gradle
(you're looking for the versionName
variable)
- iOS -
ios/App/App/Info.plist
*(you're looking for the CFBundleShortVersionString
key)
Bryant James's answer is correct, but if you want to change these files version number and build number in one single command, there is a npm package called capacitor-set-version
.
It's pretty simple to use:-
USAGE
$ capacitor-set-version <project-root-dir> -v <version> -b <build-no> --json
ARGUMENTS
DIR Capacitor project root directory
OPTIONS
-b, --build=10 App build number (Integer)
-v, --version=x.x.x App version
--json Print errors and result as JSON
-h, --help Show help
Examples:-
# Set version to 1.2.3 and build number to 10 on current folder.
capacitor-set-version -v 1.2.3 -b 10
# Set version of project on folder ./my-app
capacitor-set-version -v 1.2.3 -b 10 ./my-app
# Set android only version and build number
capacitor-set-version set:android -v 1.2.3-rc1 -b 1546 ./my-app
# Set iOS version only
capacitor-set-version set:ios -v 1.2.3 -b 10 ./my-app