Releasing a version to GitHub

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.

You must be a Member to view code

00:00 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.

00:29 To do this, you simply type Git tag, and then the name of the tag, and this was version 1.00and 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.00Now 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.

01:08 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.

01:51 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.