Reputation: 13753
I'm trying to create a node.js script which will run git commands to perform nightly builds. I have done some searching and found various bits here and there about shallow clones, reference caches, cloning one branch only etc. but I can't find any place or example for all that combined together to achieve efficient build system.
Here is the required workflow in my imagination:
get the most recent clean copy of central repo's master branch - I'd like to have only the minimum necessary but I'm not sure how to combine --depth 1 --single-branch
and if it won't lead to some problems
build the project in a dedicated folder (it is PHP project, so I'll run composer, minification etc. - I already have working node.js scripts for all that)
increase the version number in version.txt file (I have a node.js script for that)
commit the updated version.txt to local master (can I do that with a shallow, single branch clone?)
tag the last commit with the version number
push to remote master with tags (can I do that with a shallow, single branch clone?)
delete the clone folder to have a clean copy for next build
deploy to a dev server (just run git push
on a different repository)
Currently I intend to use TeamCity running on Azure VM. Git repo is on my local server. I'm not sure if I'll stay with this setup, therefore I'd like to perform most steps in node.js scripts to be platform / build system agnostic.
Is this workflow feasible or might lead to problems? Also, should I / can I speed it up with cache (git clone --reference
) or is it redundant for my case?
Upvotes: 3
Views: 1102