Skip to content

Commit d9f7c59

Browse files
feat: Add branch selector to npm publish workflow (#6)
## Summary Workflow updated ## Type - [ ] Feature - [ ] Bug fix - [ ] Refactor - [ ] Documentation - [ ] Test - [ ] Chore ## Checklist - [ ] Targets `dev` branch (not `main`) - [ ] Tests pass (`pnpm test`) - [ ] No new warnings or errors - [ ] Added/updated tests for new functionality - [ ] Updated docs if behavior changed ## Testing How did you test this? Steps to verify: 1. 2. ## Related Issues Closes #
2 parents 0455f72 + b096513 commit d9f7c59

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ name: Publish to npm
33
on:
44
workflow_dispatch:
55
inputs:
6+
branch:
7+
description: 'Branch to publish from'
8+
type: choice
9+
options:
10+
- main
11+
- dev
12+
default: main
613
dry_run:
714
description: 'Dry run — show what would be published without actually publishing'
815
type: boolean
@@ -23,6 +30,8 @@ jobs:
2330
steps:
2431
- name: Checkout
2532
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ inputs.branch }}
2635

2736
- name: Setup pnpm
2837
uses: pnpm/action-setup@v4
@@ -46,7 +55,7 @@ jobs:
4655
run: |
4756
PKG_VERSION=$(node -p "require('./package.json').version")
4857
REF_TYPE="${{ github.ref_type }}"
49-
BRANCH="${{ github.ref_name }}"
58+
BRANCH="${{ inputs.branch }}"
5059
5160
if [[ "$REF_TYPE" == "tag" ]]; then
5261
# Explicit tag (e.g. v1.2.3 or v1.2.3-rc.1) — always publish as latest
@@ -66,7 +75,7 @@ jobs:
6675
echo "channel=stable" >> $GITHUB_OUTPUT
6776
fi
6877
69-
elif [[ "$BRANCH" == "beta" || "$BRANCH" == "next" ]]; then
78+
elif [[ "$BRANCH" == "dev" || "$BRANCH" == "beta" || "$BRANCH" == "next" ]]; then
7079
# Pre-release branches — append date + short SHA so every commit gets a unique version
7180
SHORT_SHA=$(git rev-parse --short=7 HEAD)
7281
DATE=$(date -u +%Y%m%d)

0 commit comments

Comments
 (0)