Skip to content

Commit

Permalink
fix: export vaultName on startBuildWithCertificateAndPasswordFromOneP…
Browse files Browse the repository at this point in the history
…assword
  • Loading branch information
vanlooverenkoen committed Dec 12, 2023
1 parent 49503ad commit 020ad4c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
3 changes: 2 additions & 1 deletion example/bin/ic_op_cicdflow_ios_1password.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:impaktfull_cli/impaktfull_cli.dart';
import 'example_config.dart';

Future<void> main(List<String> arguments) => ImpaktfullCli().run(
(cli) => cli.ciCdPlugin.startBuildWithCertificateAndPasswordFromOnePassword(
(cli) =>
cli.ciCdPlugin.startBuildWithCertificateAndPasswordFromOnePassword(
vaultName: ExampleConfig.onePasswordVaultName,
opUuid: ExampleConfig.onePasswordUuid,
keyChainName: ExampleConfig.keyChainName,
Expand Down
18 changes: 12 additions & 6 deletions example/bin/ic_op_script.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ Future<void> main(List<String> arguments) => ImpaktfullCli().run(
final keyChainName = ExampleConfig.keyChainName;
final opUuid = ExampleConfig.onePasswordUuid;
final opVaultName = ExampleConfig.onePasswordUuid;
final globalKeyChainPasswordSecret = ExampleConfig.globalKeyChainPassword;
ImpaktfullCliEnvironment.requiresInstalledTools([CliTool.onePasswordCli]);
final globalKeyChainPasswordSecret =
ExampleConfig.globalKeyChainPassword;
ImpaktfullCliEnvironment.requiresInstalledTools(
[CliTool.onePasswordCli]);

final certFile = await onePasswordPlugin.downloadDistributionCertificate(opUuid: opUuid);
final certFile = await onePasswordPlugin
.downloadDistributionCertificate(opUuid: opUuid);
final certPassword = await onePasswordPlugin.getCertificatePassword(
opUuid: opUuid,
vaultName: opVaultName,
);

await keyChainPlugin.createKeyChain(keyChainName, globalKeyChainPasswordSecret);
await keyChainPlugin.unlockKeyChain(keyChainName, globalKeyChainPasswordSecret);
await keyChainPlugin.addCertificateToKeyChain(keyChainName, certFile, certPassword);
await keyChainPlugin.createKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await keyChainPlugin.unlockKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await keyChainPlugin.addCertificateToKeyChain(
keyChainName, certFile, certPassword);

ImpaktfullCliLogger.debug('Execute build');
await Future.delayed(const Duration(seconds: 2));
Expand Down
18 changes: 12 additions & 6 deletions lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class CiCdPlugin extends ImpaktfullPlugin {
if (playStoreUploadConfig != null) {
await playStorePlugin.uploadToPlayStore(
file: file,
serviceAccountCredentialsFile: playStoreUploadConfig.serviceAccountCredentialsFile,
serviceAccountCredentialsFile:
playStoreUploadConfig.serviceAccountCredentialsFile,
);
}
}
Expand Down Expand Up @@ -148,7 +149,8 @@ class CiCdPlugin extends ImpaktfullPlugin {
await testflightPlugin.uploadToTestflightWithEmailPassword(
file: file,
email: testflightUploadConfig.credentials?.userName,
appSpecificPassword: testflightUploadConfig.credentials?.appSpecificPassword,
appSpecificPassword:
testflightUploadConfig.credentials?.appSpecificPassword,
type: testflightUploadConfig.type,
);
}
Expand Down Expand Up @@ -192,11 +194,15 @@ class CiCdPlugin extends ImpaktfullPlugin {
Secret? globalKeyChainPassword,
}) async {
ImpaktfullCliEnvironment.requiresMacOs(reason: 'Building iOS/macOS apps');
final globalKeyChainPasswordSecret = globalKeyChainPassword ?? ImpaktfullCliEnvironmentVariables.getUnlockKeyChainPassword();
final globalKeyChainPasswordSecret = globalKeyChainPassword ??
ImpaktfullCliEnvironmentVariables.getUnlockKeyChainPassword();

await macOsKeyChainPlugin.createKeyChain(keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.unlockKeyChain(keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.addCertificateToKeyChain(keyChainName, certFile, certPassword);
await macOsKeyChainPlugin.createKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.unlockKeyChain(
keyChainName, globalKeyChainPasswordSecret);
await macOsKeyChainPlugin.addCertificateToKeyChain(
keyChainName, certFile, certPassword);
await onStartBuild();
await macOsKeyChainPlugin.removeKeyChain(keyChainName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'package:impaktfull_cli/src/core/util/logger/logger.dart';
import 'package:impaktfull_cli/src/integrations/testflight/model/testflight_credentials.dart';

class OnePasswordPlugin extends ImpaktfullCliPlugin {
String get serviceAccountEnvKey => ImpaktfullCliEnvironmentVariables.envKeyOnePasswordAccountToken;
String get serviceAccountEnvKey =>
ImpaktfullCliEnvironmentVariables.envKeyOnePasswordAccountToken;

const OnePasswordPlugin({
required super.processRunner,
Expand Down

0 comments on commit 020ad4c

Please sign in to comment.