GitHub Upload Release Asset
The GitHub Upload Release Asset recipe uploads a file as an asset to a GitHub release using the GitHub REST API — for example a build artifact at the end of a release pipeline.
| Recipe ID | jjideenschmiede/github-upload-release-asset |
| Marketplace | GitHub Upload Release Asset |
| Source code | GitHub |
How It Works
The recipe first checks that the given file exists. If no release ID is given, it determines the latest release of the repository. The file is then uploaded as an asset to the release. If one of the steps fails, the build step fails with the error message of the GitHub API.
Installation
The recipe requires TeamCity 2025.03 or later. How to add it to a build configuration is described under Using a Recipe.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
| Repository | Yes | – | GitHub repository in owner/repo format, for example JetBrains/teamcity-recipes |
| Release ID | No | Latest release | ID of the GitHub release to upload the asset to. If the field is left empty, the latest release of the repository is used. |
| GitHub Access Token | Yes | – | Personal access token with repo permissions. Create tokens at github.com/settings/tokens. |
| Asset File Path | Yes | – | Path to the file to upload. Absolute and relative paths are accepted. |
| Asset Name | No | File name | Name of the asset in the release. If the field is left empty, the file name is used. |
Example
| Input | Value |
|---|---|
| Repository | example/app |
| GitHub Access Token | %github.token% |
| Asset File Path | dist/app-%build.number%.zip |
Without a Release ID, the file is uploaded to the latest release and appears there under its file name.
Error Messages
| Message | Cause |
|---|---|
Asset file not found | No file exists at the given path. Relative paths refer to the working directory of the build step. |
Asset path is not a file | The path points to a directory |
Failed to fetch latest release (HTTP 404) | The repository has no published release or the token has no access |
Upload failed (HTTP 422) | An asset with this name already exists in the release |
Upload failed (HTTP 401) or (HTTP 403) | The token is invalid or has no write access to the repository |
Notes
- The release ID is the numeric ID from the GitHub API, not the tag name of the release.
- The latest release is the one that GitHub marks as "latest". Drafts and pre-releases are not considered.
- An asset with the same name must not exist in the release yet, otherwise GitHub rejects the upload.
- The file is loaded completely into the memory of the agent before the upload. Keep this in mind for very large files.