'How do I automate builds using App Center?
I am using App Center as CI and CD for my application. I have to configure all the branches manually against which I need to build and distribute.
What I Want
If somebody creates a feature branch from develop/master and pushes the code, then App Center should start running automatically like CircleCI etc.
Is this not possible in App Center?
Solution 1:[1]
Yes, that's possible. You need to use app center fastlane plugin. You need to use appcenter_upload
function. SSH has nothing to do with the whole process.
In your FastFile
you need to configure a lane in following manner:
desc 'Deploy a new version to the AppCenter'
lane :upload_to_appcenter do |options|
config = fetch_configuration(for_release_type: options[:release_type], for_project_dir: ENV['PROJECT_DIR'])
gradle(
task: 'assemble',
build_type: 'Release',
properties: {
"AppCenterEnvironment" => options[:release_type],
"android.injected.signing.store.file" => ENV['KEYSTORE'],
"android.injected.signing.store.password" => ENV['KEYSTORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['KEYALIAS'],
"android.injected.signing.key.password" => ENV['KEYALIAS_PASSWORD'],
"VersionPatchNumber" => config['app_version_patch_number']
})
perform_backup
appcenter_upload(
app_name: config['appcenter_name'],
file: lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
destinations: '*',
release_notes: default_changelog,
notify_testers: true,
mapping: 'app/build/outputs/mapping/release/mapping.txt'
)
end
In your CI pipeline yaml you'll have to have something line this:
- script: bundle exec fastlane upload_to_appcenter
displayName: Upload to AppCenter
condition: eq(variables['Build.SourceBranch'], 'refs/heads/development')
env:
APPCENTER_TOKEN: $(APPCENTER_API_TOKEN)
APPCENTER_OWNER_NAME: $(APPCENTER_OWNER)
RSYNC_PASSWORD: $(RSYNC_PASSWORD)
This will push version for every change of the head of development
.
Please look at the repo guide how you can provide ENV
variable, also look at your CI how you can pass params from the yaml to FastLane
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Nikola Despotoski |