1

We have a library repository that creates a new branch each time a new release is published

We have a app that refers to above mentioned library using bower.json: "lib": "git+https://example.com/path/to/library.git#<release>".

Each time a new library release appears, we have to explicitly point bower.json to the new release # as shown above.

Question:

Is there currently a mechanism (tag?) for example git+https://example.com/path/to/library.git#latest that can convey to bower, to automatically pick up latest release (branch) in this case, everytime an npm update or npm install is called ?

Vikram
  • 4,162
  • 8
  • 43
  • 65
  • Do you need to specify anything here? Won't you get the latest when you just omit the #latest part? – John Smith Sep 01 '15 at 20:13
  • @JohnSmith I thought the default meant `master`. However, I am not very sure...I'll check that. Thanks! – Vikram Sep 01 '15 at 20:15
  • @JohnSmith in my case, it did pull an older version...not exactly `master`. Cleared bower cache and did a bower reinstall. bower log says `git+https://example.com/path/to/library.git#*` whereas in `bower.json` I have `git+https://example.com/path/to/library.git` – Vikram Sep 01 '15 at 20:22

1 Answers1

1

You'll be creating tag latest and updating it at each release so that it points again to the latest commit.

Here is the workflow for passing from a v1.0.0 to v1.1.0

1) As usual you tag your version (with your own semantic)

git tag v1.0.0

2) You also specify that it's your latest version

git tag latest

3) push to remote

git push --tags origin master

4) Now you can point your bower to git+https://example.com/path/to/library.git#latest

Then do some work on your library ... Get ready to release a new version

5) Tag the new version and push to remote

git tag v1.1.0
git push --tags origin master

6) Remove the previous latest tag on remote

git push origin :refs/tags/latest

7) Replace it pointing to the new commit

git tag -fa latest

8) Finally push this new latest tag to remote

git push origin master --tags

Finally : Repeat from step 5 at each release.

Some sources : How can I move a tag on a git branch to a different commit?

Community
  • 1
  • 1
topheman
  • 7,422
  • 4
  • 24
  • 33