This action creates a release branch for your GitHub Actions which will be automatically tagged and released. The release version can be defined in package.json
.
Based on the tgymnich/publish-github-action action, but I wanted further customization and control over the release process (i.e.: adding ncc
output and not committing node_modules
directory).
- 🔐 Verified Commits - Uses GitHub API to create verified commits (when
commit_node_modules
isfalse
) - 🏷️ Annotated Tags - Creates annotated tags via Git CLI with atomic updates (no downtime)
- 🌐 Multi-instance Support - API URL defaults to the environment you are running in; works with GitHub.com, GitHub Enterprise Server, and GHE.com
- 📦 Flexible Build - Automatically installs production dependencies and supports custom build commands
- 🗂️ Selective Commits - Choose which files to include (dist, node_modules, or both)
Input | Description | Required | Default |
---|---|---|---|
github_token |
Token for the GitHub API | Yes | - |
github_api_url |
GitHub API URL (e.g., https://api.github.com for GitHub.com or https://ghes.domain.com/api/v3 for GHES) |
No | ${{ github.api_url }} |
npm_package_command |
Command to build the action | No | npm run package |
commit_node_modules |
Whether to commit node_modules folder. Note: When set to true , commits will NOT be verified due to API limitations with large file counts |
No | false |
commit_dist_folder |
Whether to commit dist folder |
No | true |
publish_minor_version |
Whether to publish minor version tag (e.g., v1.2 ) |
No | false |
publish_release_branch |
Whether to publish release branch (e.g., releases/v1.2.3 ) |
No | false |
- ✅ Verified commits (signed by GitHub) when
commit_node_modules: false
- Uses GitHub API for commits; tags are created locally via Git CLI - ❌ Unverified commits when
commit_node_modules: true
- Uses Git CLI due to API limitations with large file counts
The action automatically handles clean builds and file management:
- Dist folder cleaning: When
commit_dist_folder: true
andnpm_package_command
is specified, thedist/
folder is cleaned before building to ensure no stale files persist - Automatic file deletion: The action removes
.github/
files from release commits and properly handles renamed/deleted files in thedist/
folder
name: 'Publish GitHub Action'
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: install ncc
run: npm i -g @vercel/ncc
- uses: joshjohanning/publish-github-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
npm_package_command: npm run package
commit_node_modules: false
commit_dist_folder: true # defaults to true
publish_minor_version: false
publish_release_branch: false