diff --git a/.github/actions/npm-publish/action.yml b/.github/actions/npm-publish/action.yml
new file mode 100644
index 0000000..869f07d
--- /dev/null
+++ b/.github/actions/npm-publish/action.yml
@@ -0,0 +1,49 @@
+name: 'NPM Publish'
+description: 'Publish package to npm registry.'
+
+inputs:
+ node-version:
+ description: 'Node.js version to use.'
+ required: false
+ default: '20'
+ package-dir:
+ description: 'Directory containing package.json.'
+ required: false
+ default: '.'
+ deploy-command:
+ description: 'Publish command to execute.'
+ required: false
+ default: 'npm run deploy'
+ access-token:
+ description: 'NPM auth token.'
+ required: true
+
+runs:
+ using: 'composite'
+ steps:
+ - name: 📦 Install Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ inputs.node-version }}
+ registry-url: 'https://registry.npmjs.org'
+
+ - name: 🔍 Verify NPM Package File
+ shell: bash
+ working-directory: ${{ inputs.package-dir }}
+ run: |
+ if [ ! -f 'package.json' ]; then
+ echo '❌ package.json Not Found'
+ exit 1
+ fi
+
+ - name: 📦 Install Dependencies
+ shell: bash
+ working-directory: ${{ inputs.package-dir }}
+ run: npm ci
+
+ - name: 🚀 Deploy npm Package
+ shell: bash
+ working-directory: ${{ inputs.package-dir }}
+ env:
+ NODE_AUTH_TOKEN: ${{ inputs.access-token }}
+ run: ${{ inputs.deploy-command }}
diff --git a/.github/workflows/reusable-publish-release.yml b/.github/workflows/reusable-publish-release.yml
index 1303a71..5e0faf1 100644
--- a/.github/workflows/reusable-publish-release.yml
+++ b/.github/workflows/reusable-publish-release.yml
@@ -2,9 +2,27 @@ name: Publish Release
on:
workflow_call:
+ inputs:
+ npm-node-version:
+ description: 'Node.js version for npm publish.'
+ required: false
+ type: string
+ default: '20'
+ npm-package-dir:
+ description: 'Directory containing package.json for npm publish.'
+ required: false
+ type: string
+ default: '.'
+ npm-deploy-command:
+ description: 'Command used to publish npm package.'
+ required: false
+ type: string
+ default: 'npm run deploy'
secrets:
ACCESS_TOKEN:
required: true
+ NPM_TOKEN:
+ required: false
jobs:
publish-release:
@@ -15,7 +33,7 @@ jobs:
- name: 👣 Track Workflow Run
continue-on-error: true
run: |
- curl -s "https://abacus.jasoncameron.dev/hit/leoweyr/github-release-workflow-usage" > /dev/null
+ curl -s "https://abacus.jasoncameron.dev/hit/leoweyr/github-release-workflow-usage" > /dev/null
- name: 📂 Checkout Code
uses: actions/checkout@v4
@@ -44,3 +62,31 @@ jobs:
--title "${{ env.VERSION_TITLE }}" \
--notes-file release_body.md \
--verify-tag
+
+ - name: 🔍 Verify NPM Token
+ id: verify_npm_token
+ run: |
+ if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
+ echo '👻 NPM_TOKEN is not configured.'
+ echo 'enabled=false\n' >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ echo 'enabled=true\n' >> "$GITHUB_OUTPUT"
+
+ - name: 🔄 Sync NPM Publish Action
+ if: steps.verify_npm_token.outputs.enabled == 'true'
+ uses: actions/checkout@v4
+ with:
+ repository: 'leoweyr/github-release-workflow'
+ path: .release-workflow
+ sparse-checkout: .github/actions/npm-publish
+
+ - name: 🚀 Deploy NPM Package
+ if: steps.verify_npm_token.outputs.enabled == 'true'
+ uses: ./.release-workflow/.github/actions/npm-publish
+ with:
+ node-version: ${{ inputs.npm-node-version }}
+ package-dir: ${{ inputs.npm-package-dir }}
+ deploy-command: ${{ inputs.npm-deploy-command }}
+ access-token: ${{ secrets.NPM_TOKEN }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index db3a09e..3d19c1b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
+# [1.1.0](https://github.com/leoweyr/github-release-workflow/compare/v1.0.1...v1.1.0) (2026-04-04)
+### Features
+
+* support npm publish ([7191ff0](https://github.com/leoweyr/github-release-workflow/commit/7191ff0f6d537348fc5ccf6115ecbfac8c5dbd19)) [@leoweyr](https://github.com/leoweyr)
+
+
+
# [1.0.1](https://github.com/leoweyr/github-release-workflow/compare/v1.0.0...v1.0.1) (2026-03-29)
### Bug Fixes
diff --git a/README.md b/README.md
index 6a699e0..a5bacaf 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+


@@ -38,4 +38,17 @@ This workflow streamlines your release process into a few simple steps:
4. **Review and Merge**: Review the Pull Request created by the bot.
* **Do not modify the Pull Request title or body**, as they are used for the release metadata.
* Merge the Pull Request.
- * The workflow will automatically create a GitHub Release for you.
+ * The workflow will automatically create coordinated releases across GitHub and supported package registries.
+
+## 📦 Optional Publishing
+
+> [!NOTE]
+>
+> If the required secret for the release target are not configured, publishing will not start.
+
+Configure target publishing in your user-side entry workflow (`.github/workflows/publish-release.yml`):
+
+| Release Target | Required Secret | User-Side Inputs (`with`) |
+|----------------|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
+| GitHub Release | `ACCESS_TOKEN` (Mapped from `secrets.GITHUB_TOKEN`) | None |
+| NPM | `NPM_TOKEN` | `npm-node-version` (Default `20`)
`npm-package-dir` (Default `.`)
`npm-deploy-command` (Default `npm run deploy`) |