Implementation
Map<String, dynamic> get structures => {
"name": "Distribution CLI",
"description": "A CLI tool to build and publish your application.",
"variables": {
"ANDROID_PACKAGE": argResults?['android-package-name'] as String?,
"IOS_PACKAGE": argResults?['ios-package-name'] as String?,
"APPLE_ID": "\${APPLE_ID}",
"APPLE_APP_SPECIFIC_PASSWORD": "\${APPLE_APP_SPECIFIC_PASSWORD}",
},
"tasks": [
Task(
name: "Android Build and deploy",
key: "android",
description: "Build and deploy the Android application to playstore.",
workflows: ["build", "publish"],
jobs: [
Job(
name: "Build Android",
description: "Build the Android application using Gradle.",
key: "build",
packageName: "\${{ANDROID_PACKAGE}}",
builder: BuilderJob(
android: android_arguments.Arguments(
Variables.fromSystem(globalResults),
binaryType: "aab",
buildMode: "release",
),
),
),
Job(
name: "Publish Android",
description:
"Publish the Android application to playstore as internal test track.",
key: "publish",
packageName: "\${{ANDROID_PACKAGE}}",
publisher: PublisherJob(
fastlane: fastlane_publisher.Arguments(
Variables.fromSystem(globalResults),
filePath: Files.androidDistributionOutputDir.path,
metadataPath: Files.androidDistributionMetadataDir.path,
jsonKey: Files.fastlaneJson.path,
track: 'internal',
trackPromoteTo: 'production',
binaryType: 'aab',
skipUploadImages: true,
skipUploadScreenshots: true,
),
),
),
],
).toJson(),
if (Platform.isMacOS)
Task(
name: "iOS Build and deploy",
key: "ios",
description: "Build and deploy the iOS application to app store.",
jobs: [
Job(
name: "Build iOS",
description: "Build the iOS application using Xcode.",
key: "build",
packageName: "\${{IOS_PACKAGE}}",
builder: BuilderJob(
ios: ios_arguments.Arguments(
Variables.fromSystem(globalResults),
binaryType: "ipa",
buildMode: "release",
),
),
),
Job(
name: "Publish iOS",
description: "Publish the iOS application to app store.",
key: "publish",
packageName: "\${{IOS_PACKAGE}}",
publisher: PublisherJob(
xcrun: xcrun_publisher.Arguments(
Variables.fromSystem(globalResults),
filePath: Files.iosDistributionOutputDir.path,
username: "\${{APPLE_ID}}",
password: "\${{APPLE_APP_SPECIFIC_PASSWORD}}",
),
),
),
],
).toJson(),
],
};