Sure, let me clarify! :)

  1. Do you have two branches (develop, master) or just a single branch called develop that is the “master” in the repo?

Just the one branch, and you can call it whatever you want. We use ‘develop’. That’s your ‘bleeding edge’ branch. You’re free to have feature branches too — but for this model, you would avoid having any other branches that represent the deployed state of the code, like a ‘master’ branch for deployed code or a ‘release’ branch for code to-be-released.

2. How are the tags generated? In your CI server? Is it done after each push or on a schedule such as daily or is it after you consider what you’ve been working on a new release?

Yep, exactly. The CI server should:

  • Do npm install, bower install
  • Call npm shrinkwrap to create an npm-shrinkwrap.json (and does a bower shrinkwrap too, if you’re using bower)
  • Take those files, add them to git, and create a new git commit with them included.
  • Create a new git tag from that commit
  • Push the tag back to github (or your git server of choice)

As for when this happens — it’s any time you’re ready to release some new code, and you want to create a build. For us this is triggered manually, but there’s no reason you couldn’t do this on a schedule if that works for you.

3. How do you go about attaching the shrinkwrap to your tag? Custom action once the build completes that it runs a “npm shrinkwrap”, commits that with a new tag?

Yep, exactly. That way whatever ends up in your build is pretty much a carbon copy of what ends up in the tag. Except obviously you’re not pushing all of your dependencies to the tag, just shrinkwrap files which let you create a near-identical build later.

Hope this helps!

-Daniel

works for PayPal, as a lead engineer in Checkout. Opinions expressed herein belong to him and not his employer. daniel@bluesuncorp.co.uk

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store