mirror of
https://github.com/expo/turtle.git
synced 2026-11-15 09:38:07 -10:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e37dff366d | ||
|
|
b52158bd3d | ||
|
|
8814976dee | ||
|
|
b3b501761a | ||
|
|
86eb5badfc | ||
|
|
10f0095e2c | ||
|
|
7d5b0b0907 | ||
|
|
50c9265505 | ||
|
|
08a8cb5c40 |
No files matched your search
@@ -6,7 +6,7 @@ import { createBuilderContext, IContext } from 'turtle/builders/ios/context';
|
||||
import buildSimulator from 'turtle/builders/ios/simulator';
|
||||
import { logErrorOnce } from 'turtle/builders/utils/common';
|
||||
import prepareAdHocBuildCredentials from 'turtle/builders/utils/ios/adhocBuild';
|
||||
import { uploadBuildToS3 } from 'turtle/builders/utils/uploader';
|
||||
import { uploadBuildToS3, uploadBuildToTestFlight } from 'turtle/builders/utils/uploader';
|
||||
import { ensureCanBuildSdkVersion } from 'turtle/builders/utils/version';
|
||||
import config from 'turtle/config';
|
||||
import { IOS } from 'turtle/constants/index';
|
||||
@@ -38,6 +38,14 @@ export default async function iosBuilder(job: IJob): Promise<IJobResult> {
|
||||
throw new Error(`Unsupported iOS build type: ${buildType}`);
|
||||
}
|
||||
|
||||
// Upload to app store
|
||||
if (job.config.upload) {
|
||||
const { options, bundleIdentifier } = job.config;
|
||||
if (options) {
|
||||
await uploadBuildToTestFlight(ctx, options, bundleIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
const artifactUrl = await uploadBuildToS3(ctx);
|
||||
return { artifactUrl };
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import { ExponentTools } from 'xdl';
|
||||
|
||||
import { uploadFile } from 'turtle/aws/s3';
|
||||
import { IContext } from 'turtle/builders/ios/context';
|
||||
import config from 'turtle/config';
|
||||
import logger from 'turtle/logger';
|
||||
|
||||
@@ -10,6 +12,14 @@ interface IUploadCtx {
|
||||
uploadPath: string;
|
||||
}
|
||||
|
||||
interface IJobOptions {
|
||||
appleId: string;
|
||||
applePassword: string;
|
||||
appSpecificPassword: string;
|
||||
appName: string;
|
||||
companyName: string;
|
||||
}
|
||||
|
||||
export async function uploadBuildToS3(ctx: IUploadCtx) {
|
||||
if (config.builder.fakeUpload) {
|
||||
const l = logger.child({ buildPhase: 'copying build artifact' });
|
||||
@@ -29,3 +39,62 @@ export async function uploadBuildToS3(ctx: IUploadCtx) {
|
||||
return fileLocation;
|
||||
}
|
||||
}
|
||||
|
||||
export async function uploadBuildToTestFlight(ctx: IContext, options: IJobOptions, bundleIdentifier?: string) {
|
||||
const fastlaneEnvVars = {
|
||||
FASTLANE_USER: options.appleId,
|
||||
FASTLANE_SKIP_UPDATE_CHECK: 1,
|
||||
FASTLANE_DISABLE_COLORS: 1,
|
||||
CI: 1,
|
||||
LC_ALL: 'en_US.UTF-8',
|
||||
FASTLANE_PASSWORD: options.applePassword,
|
||||
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: options.appSpecificPassword,
|
||||
};
|
||||
|
||||
const produceArgs = [
|
||||
'produce',
|
||||
'--username',
|
||||
options.appleId,
|
||||
'--app_identifier', // bundle id
|
||||
bundleIdentifier,
|
||||
'--app_name',
|
||||
options.appName,
|
||||
'--app_version',
|
||||
'1.0',
|
||||
'--company_name',
|
||||
options.companyName,
|
||||
];
|
||||
|
||||
await ExponentTools.spawnAsyncThrowError('fastlane', produceArgs, {
|
||||
env: {
|
||||
...process.env,
|
||||
...fastlaneEnvVars,
|
||||
},
|
||||
pipeToLogger: true,
|
||||
dontShowStdout: false,
|
||||
loggerFields: { buildPhase: 'Creating App on AppStoreConnect' },
|
||||
});
|
||||
|
||||
const uploadArgs = [
|
||||
'pilot',
|
||||
'upload',
|
||||
'--username',
|
||||
options.appleId,
|
||||
'--ipa',
|
||||
ctx.uploadPath,
|
||||
'--apple_id', // The unique App ID provided by App Store Connect
|
||||
process.env.PRODUCE_APPLE_ID,
|
||||
'--skip_submission',
|
||||
'--skip_waiting_for_build_processing',
|
||||
];
|
||||
|
||||
await ExponentTools.spawnAsyncThrowError('fastlane', uploadArgs, {
|
||||
env: {
|
||||
...process.env,
|
||||
...fastlaneEnvVars,
|
||||
},
|
||||
pipeToLogger: true,
|
||||
dontShowStdout: false,
|
||||
loggerFields: { buildPhase: 'Uploading IPA to Testflight' },
|
||||
});
|
||||
}
|
||||
@@ -12,6 +12,14 @@ export interface IJob {
|
||||
// ios
|
||||
buildType?: IOS.BUILD_TYPES;
|
||||
bundleIdentifier?: string;
|
||||
upload?: boolean;
|
||||
options?: {
|
||||
appleId: string;
|
||||
applePassword: string;
|
||||
appSpecificPassword: string;
|
||||
appName: string;
|
||||
companyName: string;
|
||||
};
|
||||
// android
|
||||
androidPackage?: string;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user