How to add files to existing GitHub release inside workflow

Abstract: Resolve GitHub API immutability by uploading assets to existing releases via workflow using the release ID and upload endpoint.

Created: 2026-08-31 by
You cannot directly append files to an existing GitHub Release via the REST API because releases are immutable objects once created. Instead, you must fetch the release ID in your workflow, upload the new artifact using the Upload Release Asset endpoint, and verify the addition. This approach ensures your CI/CD pipeline correctly distributes updated binaries without recreating the entire release metadata.

Understanding GitHub Release Immutability

GitHub treats a Release as a distinct entity tied to a specific Git tag or commit. When you publish a release, it becomes a snapshot of that point in history. The GitHub REST API does not provide an endpoint to "add" assets to an existing release object after its initial creation. Attempting to update the release body or title is possible, but modifying the asset list requires a different strategy.

This design choice prevents race conditions where multiple workers might try to modify the same release simultaneously. It also maintains a clear audit trail for each release version. Therefore, the standard pattern in GitHub Actions workflows is to treat the release as a container that accepts uploads during the build process, rather than a mutable database record.

Fetching the Release ID

To upload a file to an existing release, your workflow first needs to identify which release corresponds to the current run. You typically do this by querying the GitHub API for the release associated with the tag being pushed. If you are triggering on a push event to a specific branch or tag, you can extract the tag name from the environment variables provided by GitHub.

curl --silent \
  -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
  https://api.github.com/repos/${{ github.repository }}/releases/tags/${TAG_NAME} \
  | jq '.id'

The command above uses jq to parse the JSON response and extract the numeric ID of the release. You should store this ID in a workflow output variable so subsequent steps can reference it. If no release exists yet, you may need to create one first using the Create a Release endpoint before proceeding to upload assets.

Uploading Assets via Workflow

Once you have the release ID, you can upload files using the Upload Release Asset endpoint. This endpoint accepts multipart form data containing the binary content of your file. In a GitHub Actions workflow, you can use the http action or a simple curl command within a shell step.

- name: Upload Release Asset
  run: |
    curl --data-binary @${{ github.workspace }}/build/output.zip \
      -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
      -H "Content-Type: application/octet-stream" \
      https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=output.zip

Note the distinction between the releases API endpoint and the uploads endpoint. The upload URL always starts with https://uploads.github.com. This separation allows GitHub to handle large file transfers efficiently without blocking the main API server. Ensure that the filename matches exactly what you expect users to download.

Handling Multiple Files

If you need to add multiple files to the same release, repeat the upload step for each artifact. Each request is independent, so they can run sequentially or in parallel depending on your concurrency settings. Be cautious about naming collisions; if a file with the same name already exists, the upload will fail unless you delete the existing asset first.

Common Pitfalls and Solutions

Developers often encounter issues when managing assets across multiple workflow runs. One common problem is accidentally overwriting previous builds or leaving stale artifacts behind. Unlike local file systems, GitHub Releases do not automatically clean up old files when you upload a new one with the same name.

  • Token Permissions: Ensure your GITHUB_TOKEN has sufficient permissions. By default, it usually has contents: write, which is required for creating and updating releases. If you are using a custom PAT, explicitly grant it repo-level access.
  • File Paths: Verify that the file path in your @ argument points to the correct location in the runner's workspace. Use absolute paths or relative paths from ${{ github.workspace }} to avoid confusion.
  • Idempotency: If your workflow runs multiple times for the same tag, consider deleting the asset before uploading it again. You can list assets using the List Release Assets endpoint and filter by name to find the ID of the existing file to delete.

For more details on managing checksums and file integrity in your pipelines, see GitHub Action: Why is appending checksum after each step to checksums.txt overwriting the file each time?. Understanding how your workflow handles file states is crucial when dealing with release assets.

Verifying the Upload

After running your workflow, always check the release page on GitHub to confirm the new file appears. The UI will show the file size and name. You can also use the API to list assets again and compare the count or names against your expectations. Automated verification steps can be added to your workflow to fail the build if the upload did not succeed.

Frequently Asked Questions

Can I edit the release notes after adding files?

Yes, you can update the release body and title at any time using the Update a Release endpoint. This is separate from the asset upload process and does not affect the immutability of the attached files. Many teams prefer to update the notes last to include links to the newly uploaded assets.

What happens if I upload a file with a duplicate name?

The upload will fail with a 422 Unprocessable Entity error if a file with that exact name already exists in the release. You must either rename the new file or delete the existing asset first using the Delete a Release Asset endpoint. Always handle this error gracefully in your workflow scripts.

Is there a limit to the number of assets per release?

GitHub does not enforce a strict limit on the number of files, but each individual asset is capped at 2 GB. The total storage used by all releases in a repository counts toward your overall storage quota. Large numbers of small assets are generally fine, but very large files may require chunked uploads or alternative distribution methods like CDN.

How do I delete an old asset from a release?

You can delete an asset by calling the Delete a Release Asset endpoint with the specific asset ID. First, list the assets to find the ID of the file you want to remove, then send a DELETE request. This is useful for cleaning up failed builds or replacing outdated binaries before uploading a corrected version.

Can I use third-party actions to manage releases?

Yes, many community actions like softprops/action-gh-release simplify the process by handling both creation and asset uploads in one step. These actions abstract away the raw API calls and provide easier configuration options. However, understanding the underlying API mechanics helps when you need to perform complex operations like appending to existing releases.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More