Skip to content

Commit d8a9c17

Browse files
authored
ci: add beta publish workflow (#17)
1 parent f74bca0 commit d8a9c17

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/publish-beta.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Beta to NPM
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
preid:
7+
description: 'Pre-release identifier (e.g. beta, alpha, rc)'
8+
required: false
9+
default: 'beta'
10+
type: string
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
publish-beta:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '18'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Build package
33+
run: npm run build
34+
35+
- name: Set beta version
36+
run: |
37+
BASE_VERSION=$(node -p "require('./package.json').version")
38+
BETA_VERSION="${BASE_VERSION}-${{ github.event.inputs.preid }}.${{ github.run_number }}"
39+
npm version "$BETA_VERSION" --no-git-tag-version
40+
echo "Publishing version: $BETA_VERSION"
41+
42+
- name: Publish beta to npm
43+
run: npm publish --tag ${{ github.event.inputs.preid }} --access public
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)