This repo is an example Nx monorepo to demonstrate how to use Copybara Action to open-source a part of the monorepo. Pull-Requests in the destination repo will be synced back to your main repo.
Source of Truth Destination
+---------------+ Copybara +---------------+
| Branch +------------> | Branch |
+-------+-------+ +---------------+
^
|
|
+-------+-------+ Copybara +---------------+
| Pull Requests | <------------+ Pull Requests |
+---------------+ +---------------+
- Apps and libs are tagged properly
- Running
node tools/externals/prepare.js todos
will updateexternals/todos
. (The output of this tool must be kept up to date and committed, you could set-up a pre-commit hook) - The Github workflow
.github/workflows/move-code.yml
will then take care of the rest.
- Fork this repo
- Create another empty repo to use as the destination
- Configure the secrets
- Run
node tools/externals/prepare.js blog
on your fork, you will see the new folderexternals/blog
- Change
.github/workflows/move-code.yml
accordingly (basically search/replace todos by blog) and adjust the sot/destination repo values.
The two important bits that you need to copy in your own repo are prepare.js and the Github workflow. Check out Copybara Action for more customization.
Edit to push...