Skip to content

Commit 78a5f46

Browse files
authored
Enhance npm publish workflow with prerelease option (#144)
Added input option for prerelease publishing in workflow.
1 parent 616bf7f commit 78a5f46

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/workflows/npm-publish.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
name: Publish npm package
2-
32
on:
43
release:
54
types: [created]
65
workflow_dispatch:
7-
6+
inputs:
7+
prerelease:
8+
description: 'Publish as prerelease (adds --tag next)'
9+
required: false
10+
type: boolean
11+
default: false
812
env:
913
rootDir: ./packages/nextjs-cache-handler
10-
1114
jobs:
1215
publish-npm:
1316
runs-on: ubuntu-latest
14-
1517
defaults:
1618
run:
1719
working-directory: ${{ env.rootDir }}
1820
steps:
1921
- name: Checkout code
2022
uses: actions/checkout@v4
21-
2223
- name: Copy README file to package directory
2324
run: |
2425
cp ../../README.md .
25-
2626
- uses: actions/setup-node@v4
2727
with:
2828
cache: npm
2929
node-version: lts/*
3030
cache-dependency-path: ${{ env.rootDir }}/package-lock.json
3131
registry-url: "https://registry.npmjs.org"
3232
- run: npm ci
33-
- run: npm publish --access public
33+
- name: Publish to npm
34+
run: |
35+
if [ "${{ github.event.inputs.prerelease }}" == "true" ]; then
36+
npm publish --access public --tag next
37+
else
38+
npm publish --access public
39+
fi
3440
env:
3541
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)