The end goal of any mobile development project is deployment to the app stores. Did you know you can deploy your application to the store using the NativeScript CLI? This is an excellent, hidden gem in NativeScript, perfect for automation scenarios like Continuous Integration.
Imagine that you have a “release” branch, and that every time you push to that branch Travis automatically loads your app up into iTunes Connect. Automate all the things, no?
Another benefit is the ability to skip Xcode altogether. The CLI deploy feature coupled with NativeScript's ability to let you add an Info.plist file in your app’s App_Resources folder, really does make it possible to build an iOS app without Xcode from start to finish, if you choose to do so.
You can find the help docs for this directly in your CLI. Run this command:
Also, be sure to read
the official documentation on Using NativeScript CLI to Publish an App in the App Store.
Cool right? Let's take a closer look at how you can use this feature.
Publishing to iTunes Connect using NativeScript CLI
Command:
$ tns publish ios [<Apple ID> [<Password>]]
$ tns publish ios [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]
$ tns publish ios [<Apple ID> [<Password>]] --ipa <Ipa File Path>
Where:
- <Apple ID> and <Password> are the user's credentials for https://itunesconnect.apple.com
- <Mobile Provisioning Profile Identifier> is the desired provision's identifier. It can easily be obtained by running iPhone Configuration Utility
- <Code Sign Identity> is the sign identity which will be used for building. You can set it to something generic like 'iPhone Distribution' to let the build automatically detect a code sign identity. The Code sign identity may also be set using a .xcconfig file inside app/App_Resources/iOS by setting CODE_SIGN_IDENTITY variable
When using:
$ tns publish ios [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]
the NativeScript CLI issues a release build after which uses that release build for publishing to the iTunes Connect.
On the other hand with:
$ tns publish ios [<Apple ID> [<Password>]] --ipa <Ipa File Path>
you provide a complete IPA package. The NativeScript CLI will use that package for publishing. That way you can be 100% sure the tested and verified package is propagated to production.
Right now, this is an iOS only feature. If you are interested in an Android version, please vote for
Android CLI deployment to Google Play at our Ideas portal.
Big thanks to these excellent folks for helping with this post:
Dimitar Kerezov,
Rosen Vladimirov,
Panayot Cankov and
TJ VanToll