How to change eas submit linked to project?

managed workflow
eas cli version 0.48.1

After doing a eas build then I run eas submit. I have multiple projects in my expo account and when doing eas submit it says “Linked to project B” but I want to link to project A that I just built. Any way to change this?

It’s submitting project in your current working directory, so if you run eas build and eas submit one after another it should refer to the same project.

If you have dynamic config that is changing projects based on some env you need to specify that env when running submit, for build envs from eas.json are automatically loaded.

Thanks for your reply. I am using a dynamic config. It’s not working though:

My eas.json:

{
  "cli": {
    "version": ">= 0.47.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal",
      "env": {
        "profile": "development"
      }
    },
    "preview": {
      "distribution": "internal",
      "env": {
        "profile": "preview"
      }
    },
    "staging": {
      "env": {
        "profile": "staging"
      }
    },
    "production": {
      "env": {
        "profile": "production"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

My app.config.js

export default ({ config }) => {
    if (process.env.profile === 'staging') {
        let newConfig = { ...config };
        newConfig.slug = "splend-staging";
        newConfig.android.package = "com.splend.staging";
        newConfig.ios.bundleIdentifier = "com.splend.staging"
        return newConfig;
    } else if (process.env.profile === 'production') {
        let newConfig = { ...config };
        newConfig.slug = "splend";
        newConfig.android.package = "com.splend.members";
        newConfig.ios.bundleIdentifier = "com.splend.members"
        newConfig.hooks.postPublish[0].config.project = 'splend'
        return newConfig;
    } else {
        return config;
    }

};

When I run

eas submit --profile production

it thinks the project is splend-staging. Which is the default in the app.json but should have been overwritten.

What if you run the following (assuming macOS/Linux)?

profile=production eas submit --profile=production

Or Windows:

npx cross-env profile=production eas submit --profile=production

I have a mac and that worked.

I’m guessing that the env variable is not propagating through when using eas submit and that’s what profile=production is used for?

profile=production sets the environment variable on your machine for the duration of the command.

The environment variables in eas.json are only used for the build.

I haven’t looked into how best to use environment variables with Expo all that much yet.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.