Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 986 of the free egghead.io lessons, plus get JavaScript content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Releasing a version to GitHub

2:27 JavaScript lesson by

Now that you've released your module to npm, it's time to learn how to associate that release with a particular commit on GitHub. In this lesson learn how to create a tag using git tag and then how to associate that with a release on GitHub.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

Now that you've released your module to npm, it's time to learn how to associate that release with a particular commit on GitHub. In this lesson learn how to create a tag using git tag and then how to associate that with a release on GitHub.

Avatar
Andrey

Now you can use 'npm version'. It does most of the things automatically.

Avatar
Kent C.

Very true. However, as you'll find in the future lessons, you wont be versioning things yourself :-)

In reply to Andrey
Avatar
Cameron Roe

How did you add the stars to the description? What's the key command?

One other important aspect of releasing a package onto NPM is to associate the version that you have on NPM with your GitHub repository. You accomplish this by adding a version tag to your GitHub repository. A tag in Git is just something that points to a particular commit, so that you can easily go back to that commit that is associated with a release of some kind, or some other important aspect of your Git history.

To do this, you simply type Git tag, and then the name of the tag, and this was version 1.0.0, and so that will be the name of our tag. Now, we can say Git Push --tags, to push out tags, and that will go up to GitHub, and so now if we look at GitHub, we'll refresh here and we can see the tags here, we have a 1.0.0. Now forever, this tag is associated to this release. If somebody needs to come and look at the implementation of this release, or any other random reason, we have this associated.

GitHub will also consider this tag as a release, and it follows a convention so somebody can come and look at all of the releases for our GitHub repository. You can also even draft a new release here with this specific tag, and that tag is existing you can give it a title, "Super Awesome Initial Release," and we can describe it. "This is the first one." Let's give it some sparkles, and we can associate this as a pre-release, we can attach binaries, and we'll just go ahead and publish this release.

There we go, we've released our NPM module onto NPM, and then we've also associated that with release on our GitHub repo. In review, to do this all you need to do is type Git tag and then the version, and then you push that up with the --tags, and then on GitHub, you'll have that tag in your tags here. You go to releases, draft new release, and fill out this form with the tag version that you specified. That's how you release to both NPM and GitHub.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?