Appflow Deploy in subdirectory

My repository is set up to where my ionic app is in a subdirectory (mobile/app). I am trying to do a web build through AppFlow and it is obviously failing because my ionic app is not at the root on my project.

I have tried putting an ionic.config.json with a defaultApp pointing to mobile/app but that fails in just the same way. Any ideas for getting this to work? I would rather not have to blow up my monorepo structure as it has been working great for me.

2 Likes

Anyone have any luck with this?

How did you set up your repo for Appflow? Which instructions did you follow?

@sujan12 I understand how to set it up, my ionic project is just in /app/mobile rather than the root of the project. I just need to know for to point to that rather than the root of the project.

1 Like

I didn’t imply you didn’t know how to set it up, I wanted to know how you did it for context to possibly be able to help you. But :woman_shrugging:

Sorry didn’t mean to come off like that at all. I was following https://ionicframework.com/docs/appflow/quickstart as well as it being pretty helpful just going through the app.

I’m just at a loss because I know it’s looking at the root of the project and not sure how to point it to a subdirectory. I should have included the error:

/usr/local/bin/fastlane: [!] No www found in root of project. (RuntimeError)

So you did connect your Git repo to Ionic Appflow by adding an additional repo (or by using one of the flow for your Git repo hosting). As I understand Appflow, it will clone your repo as a first step as any CI service does. It seems to be looking for a www in the root of the project that it is checking out, which it can’t find as yours lives in mobile/app/www (correct?).

You could now try to e.g. create a symlink from www to mobile/app/www and see if that is enough, but I assume it would also need the config.xml and package.json etc which would be the next error messages.

I am not aware of any option to change the directory Appflow uses to build the app, which also means that it will probably look in /platforms/ios/ for the project which will give you further problems and stuff to symlink away.

As a better solution you could probably extract your Mobile App folder into a sub-repository that you include in the main repository somehow (git submodule probably), and do the Ionic Appflow setup only for that repository. Not sure about the workflow in your monorepo then though.

(Maybe you could also create git repo inside your git repo in the subfolder? Not sure if that is possible or should be used if it is…)

Thanks for the detailed post. I tried going down both these routes. I think both would work, but both are a bit too dirty for me. The submodule would work, but breaks my monorepo workflow like you said. The symlink requires a lot of linking and dirties up the repository.

I am going to try to go down the path of mirroring the repository on commits to a second repository that has the app at the root level. Still dirty, but at least doesn’t mess with my monorepo setup. Will let you know how that goes.

Really wish Appflow would just have a config value for the directory.

Thanks!

A working directory when you set up the source code link would be very handy, my project is embedded in a .net solution, not at the root.

Given the build is happening on a container, it should be trivial to allow the working directory to be configurable. How can I vote on feature requests? Is adding a “like” to the OP enough?

1 Like

@timclicker Where you able to figure it out?

So I am using GitHub actions for deployment, and ended up using a mirroring package which basically copies a subdirectory to a new repository on every push, then I just pointed appflow at that repo, which has worked out great.

If you want more details, let me know

@timclicker I would actually love some more details on how you setup this “mirroring package”. I am facing the same issue and am looking to setup the exact thing you are describing.

To set up a Git repo with apps in their subfolder and not in the root of the project, you can add an appflow.config.json file to the root of your project. This would allow you to build from a subdirectory setup or a mono repo in Appflow.

You can refer to the related docs here: Appflow Config Customizations & Monorepo Support - Ionic Documentation

If you are facing any further issues, I would encourage you to contact the Appflow support for further assistance.

Thanks,

3 Likes

appflow.config.json works great. Thanks, @Likhith_Aalla!

2 Likes