Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Forked from boennemann/README.md
Created August 9, 2017 02:25
Show Gist options
  • Save alexdiliberto/a97692b10009b77953b5495ea92f3f5a to your computer and use it in GitHub Desktop.
Save alexdiliberto/a97692b10009b77953b5495ea92f3f5a to your computer and use it in GitHub Desktop.
Pushing new releases of a legacy version with semantic-release

If you have a package where a lot of people are still using a legacy version of it you might want to keep pushing (security-)fixes to that "branch".

Let's say the "latest" version of your package is "5.4.0", but there is as significant amount of people still using "4.7.4" – the last version you released before doing "5.0.0".

You found a critical bug in "5.4.0" and push it as out as "5.4.1", but it applies to "4.7.4" as well and so you want to do "4.7.5".

Assuming you have semantic-release already set up, you can follow these steps to get that "4.7.5" legacy support release out.

  1. Go to the relevant commit: git checkout v4.7.4
  2. Create a new branch from it: git checkout -b 4.x (You can choose any branch name, just make sure to use the same in step 3)
  3. Add "branch": "4.x" to your package.json's "release" field
  4. Create a new "legacy" dist-tag: npm dist-tag add <your-package>@4.7.4 legacy (You can choose any tag name, except for "latest", just make sure to use the same in step 5)
  5. Add "tag": "legacy" to your 'package.json's "publishConfig" field
  6. Commit this
  7. Commit/cherry-pick the fix
  8. Push the "4.x" branch to GitHub

From now on you can keep the 4.x branch to push future fixes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment