GitHub Release with Uploaded Assets
Configure semantic-release to upload build artifacts, binaries, or archives as GitHub Release assets. Attach compiled files, documentation archives, or platform-specific builds.
Detailed Explanation
Uploading Assets to GitHub Releases
The @semantic-release/github plugin can upload files as release assets, making binaries, archives, or build artifacts available for download directly from the GitHub Release page.
Configuration
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"prepareCmd": "npm run build && tar -czf dist.tar.gz dist/"
}],
"@semantic-release/npm",
["@semantic-release/github", {
"assets": [
{"path": "dist.tar.gz", "label": "Distribution Archive"},
{"path": "dist/**/*.min.js", "label": "Minified JavaScript"}
]
}]
]
}
Asset Configuration Options
Each asset can be specified as a string (glob pattern) or an object with additional properties:
| Property | Description |
|---|---|
path |
Glob pattern matching files to upload |
name |
Custom filename for the uploaded asset |
label |
Display name shown on the release page |
Glob Pattern Examples
"assets": [
"dist/*.zip",
"build/release-*.tar.gz",
{"path": "coverage/lcov-report.zip", "label": "Coverage Report"},
{"path": "bin/myapp-*", "label": "Platform Binaries"}
]
Build Before Release
Use @semantic-release/exec with prepareCmd to run your build step before the github plugin uploads assets. The prepare step runs before the publish step, ensuring files exist when the upload happens.
Release Notes Customization
You can also customize the release body with the successComment and addReleases options to include links to other release channels or deployment status.
Use Case
CLI tools, desktop applications, or libraries that distribute compiled binaries or bundled archives alongside npm packages. Users can download platform-specific builds directly from GitHub Releases.
Try It — Semantic Release Config Builder
Related Topics
Basic npm Package Release with semantic-release
Basic Configuration
Docker Image Release with semantic-release
Advanced Configuration
Custom Shell Commands with @semantic-release/exec
Plugin Configuration
Automatic Changelog Generation with semantic-release
Basic Configuration
semantic-release Without npm Publishing
Plugin Configuration