Introduction
GitHub Releases provide a way to attach large artifacts, such as binaries or large autogenerated files, without polluting the repository. A release points to a specific commit in a repository and can include files up to 2GB in size.
For example, if we are using the code of a branch to generate a large file, we can attach this file to a release. This way, the repository remains clean and the large file is easily accessible.
Creating a Release
The simplest way to create a release is through the GitHub website:
- Navigate to the main page of your repository.
- Under your repository name, click Releases.
- Click Draft a new release.
- Click Choose a tag, create a new tag which is a good reference for the artifact, best would be a version number using Semantic Versioning, as Target, choose the branch whose tip was used to generate the file, it can be a branch of a currently open pull request (in this case see the “Important considerations” below), and click Create tag.
- Fill out the release title and description.
- To include binaries or other large files, drag and drop them into the release form.
- Click Publish release.
- It is possible to edit the release later to replace or add files.
Important Considerations
- Tagging Commits in PRs: If you put a tag on a commit that is in a pull request and then the pull request is rebased, the release will become orphaned. This is still acceptable if you just need a centralized spot to store an artifact without adding it to the repository.