I was able to get this working. I did this yaml pipeline in Azure Devops.
For ios
- task: UseNode@1
displayName: "Use Node ${{ parameters.nodeVersion }}"
inputs:
version: XX.XX
- task: Npm@1
displayName: 'npm clean'
inputs:
command: custom
verbose: false
customCommand: 'run clean'
- task: Npm@1
displayName: 'npm install nativescript'
inputs:
command: custom
verbose: false
customCommand: 'install nativescript@6 -g'
- task: PythonScript@0
displayName: "Install python package six"
inputs:
scriptSource: 'inline'
script: |
import os
os.system("pip install six")
- task: InstallAppleProvisioningProfile@1
displayName: "Install an Apple provisioning profile"
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: ${{ parameters.iosProvisionProfile }}
- task: InstallAppleCertificate@2
displayName: "Install an Apple certificate"
inputs:
certSecureFile: 'devops-cn.p12'
certPwd: ${{ parameters.certificatePassword }}
keychain: 'temp'
signingIdentity: 'iPhone Distribution: Whatever Company'
- task: PythonScript@0
displayName: "Build"
env:
IOS_PROVISION_PROFILE_NAME: ${{ parameters.iosProvisionProfileName }}
IOS_IPA_FILE_NAME: ${{ parameters.iosIpaFileName }}
inputs:
scriptSource: 'inline'
script: |
import os, shutil
os.system("tns build ios --bundle --provision \"{}\" --for-device --release".format(os.environ.get('IOS_PROVISION_PROFILE_NAME')))
For Android
- task: UseNode@1
displayName: "Use Node XX.XX"
inputs:
version: XX.XX
- task: Npm@1
displayName: "npm install"
inputs:
command: 'custom'
customCommand: 'run clean'
- task: Npm@1
displayName: "npm install nativescript"
inputs:
command: 'custom'
customCommand: 'install nativescript@6 -g'
- task: PythonScript@0
displayName: "Build"
env:
AND_KEY_STORE_PASSWORD: ${{ parameters.androidKeyStorePassword }}
AND_KEY_STORE_ALIAS: ${{ parameters.androidKeyStoreAlias }}
AND_KEY_STORE_ALIAS_PASSWORD: ${{ parameters.androidKeyStoreAliasPassword }}
inputs:
scriptSource: 'inline'
script: |
import os
os.system("tns build android --bundle --release --key-store-path \"$(secureFile.secureFilePath)\" --key-store-password \"{}\" --key-store-alias \"{}\" --key-store-alias-password \"{}\"".format(os.environ.get('AND_KEY_STORE_PASSWORD'), os.environ.get('AND_KEY_STORE_ALIAS'), os.environ.get('AND_KEY_STORE_ALIAS_PASSWORD')))