88 description : ' Version number (e.g., 1.2.3 - no v prefix)'
99 required : true
1010 type : string
11+ dry_run :
12+ description : ' Dry run mode (test without publishing)'
13+ required : false
14+ type : boolean
15+ default : false
1116
1217# Required permissions for version commits, tags, releases, and npm provenance
1318permissions :
2227 outputs :
2328 commit_sha : ${{ steps.commit.outputs.sha }}
2429 steps :
30+ - name : Check dry run mode
31+ run : |
32+ if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
33+ echo "🔍 DRY RUN MODE ENABLED - No changes will be pushed to remote"
34+ echo "================================================"
35+ fi
36+
2537 - name : Checkout
2638 uses : actions/checkout@v4
2739 with :
8698
8799 - name : Push version commit
88100 run : |
89- git push origin HEAD
90- echo "✓ Version commit pushed to remote"
101+ if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
102+ echo "🔍 DRY RUN: Would push version commit to remote"
103+ echo " Commit SHA: $(git rev-parse HEAD)"
104+ echo " Branch: $(git branch --show-current)"
105+ else
106+ git push origin HEAD
107+ echo "✓ Version commit pushed to remote"
108+ fi
91109
92110 # Job 2: Create and push version tag
93111 create-version-tag :
@@ -105,9 +123,14 @@ jobs:
105123 - name : Create and push tag
106124 run : |
107125 VERSION="${{ github.event.inputs.version }}"
108- git tag "v$VERSION"
109- git push origin "v$VERSION"
110- echo "✓ Tag v$VERSION created and pushed"
126+ if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
127+ echo "🔍 DRY RUN: Would create and push tag v$VERSION"
128+ echo " Current commit: $(git rev-parse HEAD)"
129+ else
130+ git tag "v$VERSION"
131+ git push origin "v$VERSION"
132+ echo "✓ Tag v$VERSION created and pushed"
133+ fi
111134
112135 # Job 3: Publish to NPM
113136 publish-npm :
@@ -147,9 +170,15 @@ jobs:
147170
148171 - name : Publish to NPM
149172 run : |
150- echo "Publishing to NPM with provenance..."
151- npm publish --provenance --access public
152- echo "✓ Package published to NPM registry"
173+ if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
174+ echo "🔍 DRY RUN: Testing NPM publish..."
175+ npm publish --dry-run --access public
176+ echo "✓ Dry run completed - package would be published to NPM registry"
177+ else
178+ echo "Publishing to NPM with provenance..."
179+ npm publish --provenance --access public
180+ echo "✓ Package published to NPM registry"
181+ fi
153182 env :
154183 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
155184
@@ -232,9 +261,18 @@ jobs:
232261 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
233262
234263 - name : Create Release
264+ if : github.event.inputs.dry_run != 'true'
235265 uses : softprops/action-gh-release@v1
236266 with :
237267 tag_name : v${{ github.event.inputs.version }}
238268 body : ${{ steps.release_notes.outputs.release_notes }}
239269 env :
240270 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
271+
272+ - name : Display Release Notes (Dry Run)
273+ if : github.event.inputs.dry_run == 'true'
274+ run : |
275+ echo "🔍 DRY RUN: Would create GitHub release with the following notes:"
276+ echo "---"
277+ cat release_notes.md
278+ echo "---"
0 commit comments