CI/CD Fails because missing files needed for build, but not wanted on public repo in a .gitignore

Viewed 454

I have a public repository for an open sourced project, I also have a CI/CD platform which listens for my commits and builds my application.

The issue is I have important files for the build, but that I don't want to become public in the repo.
Since the CICD is pulling from GitHub first, it is not getting the files needed to build, so it fails.

How Can I have a copy of the sensitive files for the CICD, and the ignored files for the public repo?
I am using the CodeMagic CI/CD for my flutter app BTW.

2 Answers

You could add a step in your CICD job which would clone a private repository (with the sensitive files) inside the checked out GitHub repository in the CICD job workspace.

That inner repository would be ignored by the parent checked out repository, but would still be present for the build.
A cleanup step would delete that folder after build, in order for the CICD to not expose its content when looking at the result of the job.

Related