-
Notifications
You must be signed in to change notification settings - Fork 252
58 lines (48 loc) · 1.53 KB
/
publish-package.yml
File metadata and controls
58 lines (48 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: publish-package
on:
release:
types: [created]
workflow_dispatch:
inputs:
version:
description: 'Package version (e.g., 1.2.3) - leave empty to use package.json version'
required: false
type: string
tag:
description: 'NPM tag (latest, beta, next, etc.)'
required: false
default: 'latest'
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Update version if specified
if: ${{ github.event.inputs.version != '' }}
run: |
npm version ${{ github.event.inputs.version }} --no-git-tag-version
echo "Updated package.json to version ${{ github.event.inputs.version }}"
- name: Generate NitroModule bindings
run: yarn nitro-codegen
- name: Build package
run: yarn prepare
- name: Configure npm for publishing
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish with tag
if: ${{ github.event.inputs.tag != '' }}
run: npm publish --tag ${{ github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish (default)
if: ${{ github.event.inputs.tag == '' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}