Using GitHub Releases to keep track of Large Artifacts

github
Published

January 22, 2025

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:

  1. Navigate to the main page of your repository.
  2. Under your repository name, click Releases.
  3. Click Draft a new release.
  4. 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.
  5. Fill out the release title and description.
  6. To include binaries or other large files, drag and drop them into the release form.
  7. Click Publish release.
  8. 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.