This commit is contained in:
lucadruda 2022-06-13 15:52:37 +02:00
Родитель 32e5d80890
Коммит 2a0bd5e672
6 изменённых файлов: 399 добавлений и 7 удалений

358
.azuredevops/main.yml Normal file
Просмотреть файл

@ -0,0 +1,358 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/main/service-schema.json
pool:
vmImage: 'macOS-12'
variables:
- group: iotc-cpm-android
- name: CPM_DEBUG_PROJECT_NAME
value: $(Project_Name)
- name: CPM_RELEASE_PROJECT_NAME
value: $(Project_Name)
- name: rootPath
value: '$(System.DefaultWorkingDirectory)'
name: $(Date:yyyyMMdd)$(Rev:.r)
jobs:
- job: iOS_Beta
timeoutInMinutes: 120
condition: and(succeeded(), eq(variables.isMaster, false))
variables:
rootPath: '$(System.DefaultWorkingDirectory)'
agentName: $[ dependencies.Setup.outputs['passOutput.AgentName'] ]
archivePath: '$(rootPath)/output/archive'
exportPath: '$(rootPath)/output/export'
xcodeDeveloperDir: '/Applications/Xcode_13.3.1.app/Contents/Developer'
xcarchivePath: '$(archivePath)/$(Project_Name).xcarchive'
zipToSign: '$(exportPath)/$(Project_Name).zip'
signedZip: '$(exportPath)/$(Project_Name).zip'
unsignedIpa: '$(exportPath)/$(Project_Name).ipa'
signedExtractedPath: '$(exportPath)/signed'
steps:
- task: UseRubyVersion@0
inputs:
versionSpec: '< 2.8'
- bash: gem install bundler cocoapods
- template: ./node-build.yml
- bash: npm run podinstall
- task: InstallAppleCertificate@2
inputs:
certSecureFile: '$(iOS_Dogfood_Development_Cert_Name)'
certPwd: '$(iOS_Dogfood_Development_Cert_Password)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(iOS_Dogfood_Development_Profile)'
- task: DownloadSecureFile@1
displayName: 'Download distribution profile from Azure secure files storage'
inputs:
secureFile: '$(iOS_Dogfood_Distribution_Profile)'
retryCount: 5
- task: DownloadSecureFile@1
displayName: 'Download dev exportoptions'
inputs:
secureFile: '$(iOS_Dogfood_Development_ExportOptions)'
retryCount: 5
- task: DownloadSecureFile@1
displayName: 'Download distribution exportoptions'
inputs:
secureFile: '$(iOS_Dogfood_ExportOptions)'
retryCount: 5
- task: CopyFiles@2
displayName: 'Copy distribution provisioning profile'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_Dogfood_Distribution_Profile)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy dev exportoptions'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_Dogfood_Development_ExportOptions)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy distribution exportoptions'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_Dogfood_ExportOptions)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- bash: mv $(exportPath)/$(iOS_Dogfood_ExportOptions) $(exportPath)/ExportOptions.plist
- task: Xcode@5
displayName: 'Build Mobile Application'
inputs:
actions: 'build archive'
configuration: 'Release'
xcWorkspacePath: '$(rootPath)/ios/$(Project_Name).xcworkspace'
scheme: '$(Project_Name)'
sdk: 'iphoneos15.4'
useXcpretty: false
exportPath: '$(exportPath)'
exportOptions: 'plist'
exportOptionsPlist: '$(exportPath)/$(iOS_Dogfood_Development_ExportOptions)'
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
packageApp: true
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '$(xcodeDeveloperDir)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Development App'
inputs:
PathtoPublish: '$(unsignedIpa)'
ArtifactName: 'ios_unsigned'
publishLocation: 'Container'
- task: ArchiveFiles@2
displayName: 'Create zip for signing'
inputs:
rootFolderOrFile: '$(exportPath)'
includeRootFolder: false
archiveFile: '$(zipToSign)'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk(temporary)'
inputs:
packageType: sdk
version: 2.1.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: EsrpCodeSigning@1
displayName: 'Sign build'
inputs:
ConnectedServiceName: 'IoT PnP PaaD'
FolderPath: '$(exportPath)'
Pattern: '*.zip'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"KeyCode" : "CP-464234-Apple",
"OperationCode" : "iOSAppSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: ExtractFiles@1
displayName: 'Extract signed build'
inputs:
archiveFilePatterns: '$(signedZip)'
destinationFolder: '$(signedExtractedPath)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Signed Ipa'
inputs:
PathtoPublish: '$(signedExtractedPath)'
ArtifactName: 'ios_signed'
publishLocation: 'Container'
- job: iOS_Release
timeoutInMinutes: 120
condition: and(succeeded(), eq(variables.isMaster, true))
variables:
rootPath: '$(System.DefaultWorkingDirectory)'
agentName: $[ dependencies.Setup.outputs['passOutput.AgentName'] ]
archivePath: '$(rootPath)/output/archive'
exportPath: '$(rootPath)/output/export'
xcodeDeveloperDir: '/Applications/Xcode_13.3.1.app/Contents/Developer'
xcarchivePath: '$(archivePath)/$(Project_Name).xcarchive'
zipToSign: '$(exportPath)/$(Project_Name).zip'
signedZip: '$(exportPath)/$(Project_Name).zip'
unsignedIpa: '$(exportPath)/$(Project_Name).ipa'
signedExtractedPath: '$(exportPath)/signed'
steps:
- task: UseRubyVersion@0
inputs:
versionSpec: '< 2.8'
- bash: gem install bundler cocoapods
- template: ./node-build.yml
- bash: npm run podinstall
- task: InstallAppleCertificate@2
inputs:
certSecureFile: '$(iOS_Development_Cert_Name)'
certPwd: '$(iOS_Development_Cert_Password)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(iOS_Development_Profile)'
- task: DownloadSecureFile@1
displayName: 'Download distribution profile from Azure secure files storage'
inputs:
secureFile: '$(iOS_Distribution_Profile)'
retryCount: 5
- task: DownloadSecureFile@1
displayName: 'Download dev exportoptions'
inputs:
secureFile: '$(iOS_Development_ExportOptions)'
retryCount: 5
- task: DownloadSecureFile@1
displayName: 'Download distribution exportoptions'
inputs:
secureFile: '$(iOS_ExportOptions)'
retryCount: 5
- task: CopyFiles@2
displayName: 'Copy distribution provisioning profile'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_Distribution_Profile)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy dev exportoptions'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_Development_ExportOptions)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy distribution exportoptions'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(iOS_ExportOptions)'
TargetFolder: '$(exportPath)'
flattenFolders: true
- bash: mv $(exportPath)/$(iOS_ExportOptions) $(exportPath)/ExportOptions.plist
- task: Xcode@5
displayName: 'Build Mobile Application'
inputs:
actions: 'build archive'
configuration: 'Release'
xcWorkspacePath: '$(rootPath)/ios/$(Project_Name).xcworkspace'
scheme: '$(Project_Name)'
sdk: 'iphoneos15.4'
useXcpretty: false
exportPath: '$(exportPath)'
exportOptions: 'plist'
exportOptionsPlist: '$(exportPath)/$(iOS_Development_ExportOptions)'
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
packageApp: true
xcodeVersion: 'specifyPath'
xcodeDeveloperDir: '$(xcodeDeveloperDir)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Development App'
inputs:
PathtoPublish: '$(unsignedIpa)'
ArtifactName: 'ios_unsigned'
publishLocation: 'Container'
- task: ArchiveFiles@2
displayName: 'Create zip for signing'
inputs:
rootFolderOrFile: '$(exportPath)'
includeRootFolder: false
archiveFile: '$(zipToSign)'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk(temporary)'
inputs:
packageType: sdk
version: 2.1.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: EsrpCodeSigning@1
displayName: 'Sign build'
inputs:
ConnectedServiceName: 'IoT PnP PaaD'
FolderPath: '$(exportPath)'
Pattern: '*.zip'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"KeyCode" : "CP-233039-Apple",
"OperationCode" : "iOSAppSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: ExtractFiles@1
displayName: 'Extract signed build'
inputs:
archiveFilePatterns: '$(signedZip)'
destinationFolder: '$(signedExtractedPath)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Signed Ipa'
inputs:
PathtoPublish: '$(signedExtractedPath)'
ArtifactName: 'ios_signed'
publishLocation: 'Container'
# - job: Android_Release
# steps:
# - template: ./node-build.yml
# - task: DownloadSecureFile@1
# name: androidKeystore
# inputs:
# secureFile: iotc-cpm-release.keystore
# - bash: |
# CPM_RELEASE_VERSION_CODE=$(echo $(Build.BuildNumber) | sed 's/\.//')
# echo "##vso[task.setvariable variable=CPM_RELEASE_VERSION_CODE]$CPM_RELEASE_VERSION_CODE"
# cp $(androidKeystore.secureFilePath) android/app/$CPM_RELEASE_STORE_FILE
# ls -l android/app/$CPM_RELEASE_STORE_FILE
# - bash: env | sort
# - bash: npx jetify
# - task: Gradle@2
# env:
# KEYSTORE_PASSWORD: $(CPM_RELEASE_STORE_PASSWORD)
# KEYSTORE: $(CPM_RELEASE_STORE_FILE)
# KEY_ALIAS: $(CPM_RELEASE_KEY_ALIAS)
# KEY_PASSWORD: $(CPM_RELEASE_KEY_PASSWORD)
# inputs:
# workingDirectory: 'android'
# gradleWrapperFile: 'android/gradlew'
# gradleOptions: '-Xmx3072m'
# publishJUnitResults: false
# testResultsFiles: '**/TEST-*.xml'
# tasks: 'assembleRelease'
# - task: PublishBuildArtifacts@1
# displayName: 'Publish Build Artifact'
# inputs:
# PathtoPublish: 'android/app/build/outputs/apk/release/$(Project_Name)-release.apk'
# ArtifactName: 'android'
# publishLocation: 'Container'

Просмотреть файл

@ -0,0 +1,17 @@
steps:
- task: NodeTool@0
inputs:
versionSpec: "16.14.0"
displayName: "Install Node"
- script: npm install
workingDirectory: .
displayName: "Install node dependencies"
- script: npm version prerelease --preid "$(Build.BuildNumber)" --no-git-tag-version
workingDirectory: .
displayName: "Increment version in package.json"
- task: ShellScript@2
inputs:
scriptPath: "$(System.DefaultWorkingDirectory)/bumpVersion.sh"

Просмотреть файл

@ -1,6 +1,6 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.4'
ruby '~> 2.7.4'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

Просмотреть файл

@ -2,12 +2,13 @@
* @format
*/
import { AppRegistry, Platform } from 'react-native';
import {AppRegistry, Platform} from 'react-native';
import App from './src/App';
import { name as appName } from './app.json';
if (Platform.OS === 'android') { // only android needs polyfill
require('intl'); // import intl object
require('intl/locale-data/jsonp/en-US'); // load the required locale details
import {name as appName} from './app.json';
if (Platform.OS === 'android') {
// only android needs polyfill
require('intl'); // import intl object
require('intl/locale-data/jsonp/en-US'); // load the required locale details
}
AppRegistry.registerComponent(appName, () => App);

17
package-lock.json сгенерированный
Просмотреть файл

@ -17,6 +17,7 @@
"@rneui/base": "^4.0.0-rc.1",
"@rneui/themed": "^4.0.0-rc.1",
"events": "^3.3.0",
"intl": "^1.2.5",
"react": "^17.0.2",
"react-native": "0.68.0",
"react-native-animatable": "^1.3.3",
@ -8444,6 +8445,11 @@
"node": ">= 0.4"
}
},
"node_modules/intl": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz",
"integrity": "sha512-rK0KcPHeBFBcqsErKSpvZnrOmWOj+EmDkyJ57e90YWaQNqbcivcqmKDlHEeNprDWOsKzPsh1BfSpPQdDvclHVw=="
},
"node_modules/invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
@ -13062,6 +13068,7 @@
"version": "1.1.1",
"inBundle": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.4.x"
}
@ -13070,6 +13077,7 @@
"version": "0.1.1",
"inBundle": true,
"license": "SEE LICENSE IN epl-v10",
"peer": true,
"dependencies": {
"events": "^1.1.1"
}
@ -22291,6 +22299,11 @@
"side-channel": "^1.0.4"
}
},
"intl": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz",
"integrity": "sha512-rK0KcPHeBFBcqsErKSpvZnrOmWOj+EmDkyJ57e90YWaQNqbcivcqmKDlHEeNprDWOsKzPsh1BfSpPQdDvclHVw=="
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
@ -25830,11 +25843,13 @@
"dependencies": {
"events": {
"version": "1.1.1",
"bundled": true
"bundled": true,
"peer": true
},
"react-native-paho-mqtt": {
"version": "0.1.1",
"bundled": true,
"peer": true,
"requires": {
"events": "^1.1.1"
}

Просмотреть файл

@ -23,6 +23,7 @@
"@rneui/base": "^4.0.0-rc.1",
"@rneui/themed": "^4.0.0-rc.1",
"events": "^3.3.0",
"intl": "^1.2.5",
"react": "^17.0.2",
"react-native": "0.68.0",
"react-native-animatable": "^1.3.3",