diff --git a/CHANGELOG.md b/CHANGELOG.md index 37b5c50..f80e00f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.10.1 + +# Fix: +- Export `valultName` for `startBuildWithCertificateAndPasswordFromOnePassword` on the `CiCdPlugin` + # 0.10.0 # Feat: diff --git a/example/bin/example_config b/example/bin/example_config index a76c950..ff271ba 100644 --- a/example/bin/example_config +++ b/example/bin/example_config @@ -4,6 +4,7 @@ class ExampleConfig { static final appleEmailAdress = 'your-apple-email-adress'; static final appleAppSpecificPassword = Secret('your-app-specific-password'); static const onePasswordUuid = 'your-1password-uuid'; + static const onePasswordVaultName = 'Certificates'; static const keyChainName = 'ImpaktfullCliKeyChain'; static final globalKeyChainPassword = CliInputReader.readKeyChainPassword(); } diff --git a/example/bin/ic_op_cicdflow_ios_1password.dart b/example/bin/ic_op_cicdflow_ios_1password.dart index 11d1315..ea23191 100644 --- a/example/bin/ic_op_cicdflow_ios_1password.dart +++ b/example/bin/ic_op_cicdflow_ios_1password.dart @@ -3,8 +3,8 @@ import 'package:impaktfull_cli/impaktfull_cli.dart'; import 'example_config.dart'; Future main(List arguments) => ImpaktfullCli().run( - (cli) => - cli.ciCdPlugin.startBuildWithCertificateAndPasswordFromOnePassword( + (cli) => cli.ciCdPlugin.startBuildWithCertificateAndPasswordFromOnePassword( + vaultName: ExampleConfig.onePasswordVaultName, opUuid: ExampleConfig.onePasswordUuid, keyChainName: ExampleConfig.keyChainName, globalKeyChainPassword: ExampleConfig.globalKeyChainPassword, diff --git a/example/bin/ic_op_script.dart b/example/bin/ic_op_script.dart index fa55ef1..d1305e0 100644 --- a/example/bin/ic_op_script.dart +++ b/example/bin/ic_op_script.dart @@ -8,22 +8,19 @@ Future main(List arguments) => ImpaktfullCli().run( final keyChainPlugin = cli.macOsKeyChainPlugin; final keyChainName = ExampleConfig.keyChainName; final opUuid = ExampleConfig.onePasswordUuid; - final globalKeyChainPasswordSecret = - ExampleConfig.globalKeyChainPassword; - ImpaktfullCliEnvironment.requiresInstalledTools( - [CliTool.onePasswordCli]); + final opVaultName = ExampleConfig.onePasswordUuid; + final globalKeyChainPasswordSecret = ExampleConfig.globalKeyChainPassword; + ImpaktfullCliEnvironment.requiresInstalledTools([CliTool.onePasswordCli]); - final certFile = await onePasswordPlugin - .downloadDistributionCertificate(opUuid: opUuid); - final certPassword = - await onePasswordPlugin.getCertificatePassword(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)); diff --git a/lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart b/lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart index 6105b57..7c6a182 100644 --- a/lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart +++ b/lib/src/integrations/ci_cd/plugin/ci_cd_plugin.dart @@ -86,8 +86,7 @@ class CiCdPlugin extends ImpaktfullPlugin { if (playStoreUploadConfig != null) { await playStorePlugin.uploadToPlayStore( file: file, - serviceAccountCredentialsFile: - playStoreUploadConfig.serviceAccountCredentialsFile, + serviceAccountCredentialsFile: playStoreUploadConfig.serviceAccountCredentialsFile, ); } } @@ -149,8 +148,7 @@ class CiCdPlugin extends ImpaktfullPlugin { await testflightPlugin.uploadToTestflightWithEmailPassword( file: file, email: testflightUploadConfig.credentials?.userName, - appSpecificPassword: - testflightUploadConfig.credentials?.appSpecificPassword, + appSpecificPassword: testflightUploadConfig.credentials?.appSpecificPassword, type: testflightUploadConfig.type, ); } @@ -159,6 +157,7 @@ class CiCdPlugin extends ImpaktfullPlugin { Future startBuildWithCertificateAndPasswordFromOnePassword({ required String opUuid, required String keyChainName, + required String vaultName, required Future Function() onStartBuild, Secret? rawServiceAccount, Secret? globalKeyChainPassword, @@ -171,6 +170,7 @@ class CiCdPlugin extends ImpaktfullPlugin { rawServiceAccount: rawServiceAccount, ); final certPassword = await onePasswordPlugin.getCertificatePassword( + vaultName: vaultName, opUuid: opUuid, rawServiceAccount: rawServiceAccount, ); @@ -192,15 +192,11 @@ 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); } diff --git a/lib/src/integrations/one_password/plugin/one_password_plugin.dart b/lib/src/integrations/one_password/plugin/one_password_plugin.dart index 167a7c9..0fe2995 100644 --- a/lib/src/integrations/one_password/plugin/one_password_plugin.dart +++ b/lib/src/integrations/one_password/plugin/one_password_plugin.dart @@ -7,8 +7,7 @@ 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, @@ -34,10 +33,11 @@ class OnePasswordPlugin extends ImpaktfullCliPlugin { Secret? rawServiceAccount, }) async { final exportFile = File(outputPath); - if (exportFile.existsSync()) { - ImpaktfullCliLogger.verbose('Deleting existing file: $outputPath'); - exportFile.deleteSync(); + if (!exportFile.existsSync()) { + exportFile.createSync(recursive: true); } + ImpaktfullCliLogger.verbose('Deleting existing file: $outputPath'); + exportFile.deleteSync(recursive: true); await _executeOnePasswordCommand( [ 'op', @@ -58,7 +58,7 @@ class OnePasswordPlugin extends ImpaktfullCliPlugin { Future getCertificatePassword({ required String opUuid, - String vaultName = 'Certificates', + required String vaultName, String fieldName = 'password', Secret? rawServiceAccount, }) =>