Skip to content

Commit d801302

Browse files
committed
chore: enhance publish workflow with dry-run option for safer publishing
1 parent b363848 commit d801302

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7+
inputs:
8+
dry-run:
9+
description: 'Run without actually publishing'
10+
required: false
11+
type: boolean
12+
default: false
713

814
concurrency:
915
group: publish-${{ github.ref }}
@@ -31,8 +37,14 @@ jobs:
3137
- name: Build
3238
run: bun run build
3339

34-
- name: Configure npm authentication
35-
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
36-
3740
- name: Publish
41+
if: ${{ !inputs.dry-run }}
3842
run: bun publish --ignore-scripts --registry https://npm.pkg.github.com
43+
env:
44+
NPM_CONFIG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Publish (dry-run)
47+
if: ${{ inputs.dry-run }}
48+
run: bun publish --ignore-scripts --dry-run --registry https://npm.pkg.github.com
49+
env:
50+
NPM_CONFIG_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)