es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Las variables de entorno de Fastlane Match no son recogidas por build_app.

Comencé a usar fastLane y match para la firma de código en jenkins. match logra crear exitosamente los certificados y el perfil de aprovisionamiento. Sin embargo, el paso “build_app” falla debido a que el archivo “pbxproj” establece el “CODE_SIGN_STYLE” en Automático. Quiero lograr la compilación sin modificar el archivo “pbxproj” ya que los desarrolladores utilizan la firma automática.

FastFile:

    lane :upload_debug_test_flight do
      setup_jenkins
      match
      build_app(scheme: "MyWork Dev", clean: true, export_method: "app-store")
      upload_to_testflight(.....)
    end

Archivo Match:

git_url("git@github.mywork/cert_repo.git")
storage_mode("git")
type("appstore")
api_key_path("./test.json")
app_identifier(["com.mywork.mywork-test"])
username("developer@mywork.com")

En nuestro archivo project.pbxproj tenemos:

CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
PROVISIONING_PROFILE_SPECIFIER= '';

También probé lo siguiente, pero aún así gym/build_app no está tomando las variables de entorno de match:

        build_app(
            skip_profile_detection: true,
            export_method: "app-store",
            export_options:{
                signingStyle: "manual",
                provisioningProfiles:{
                    "com.mywork.mywork-test": "match AppStore com.mywork.mywork-test"
                }
            }
        )
Tags:  , , ,

Answer

  1. Avatar for davy.ai

    Para lograr la construcción sin modificar el archivo pbxproj, puedes intentar agregar una acción postinstall a tu archivo Matchfile para modificar el CODE_SIGN_STYLE a manual después de que Match haya creado los certificados y el perfil de aprovisionamiento.

    Aquí tienes un ejemplo de cómo podría verse tu archivo Matchfile modificado:

    git_url("git@github.mywork/cert_repo.git")
    storage_mode("git")
    type("appstore")
    api_key_path("./test.json")
    app_identifier(["com.mywork.mywork-test"])
    username("developer@mywork.com")
    
    post_install do |options|
      # Cargar el archivo del proyecto
      project_path = "ruta/a/tu/project.xcodeproj"
      project = Xcodeproj::Project.open(project_path)
    
      # Encontrar el objetivo que deseas modificar
      target_name = "MyWork Dev"
      target = project.targets.find { |t| t.name == target_name }
    
      # Modificar el CODE_SIGN_STYLE a manual
      build_settings = target.build_settings(options[:configuration])
      build_settings["CODE_SIGN_STYLE"] = "Manual"
    
      # Guardar los cambios en el archivo del proyecto
      project.save
    
      # Imprimir un mensaje para confirmar la modificación
      puts "CODE_SIGN_STYLE configurado como Manual para el objetivo #{target_name}"
    end
    

    Luego, cuando ejecutes tu archivo Fastfile, debería construir la aplicación con firma manual sin modificar el archivo pbxproj:

    lane :upload_debug_test_flight do
      setup_jenkins
      match
      build_app(
        scheme: "MyWork Dev",
        clean: true,
        export_method: "app-store",
        skip_profile_detection: true,
        export_options: {
          signingStyle: "manual",
          provisioningProfiles: { "com.mywork.mywork-test" => "match AppStore com.mywork.mywork-test" }
        }
      )
      upload_to_testflight(.....)
    end
    

Comments are closed.