-
Notifications
You must be signed in to change notification settings - Fork 39
55 lines (46 loc) · 1.6 KB
/
npm.yml
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
name: NPM Release
on:
workflow_dispatch:
inputs:
packageName:
description: "Package Name (schemas, types, toolkit)"
required: true
version:
description: "Version to publish (e.g., 1.0.0)"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Validate package name
run: |
if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "types" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then
echo "Error: Invalid package name"
exit 1
fi
- name: Validate version
run: |
if ! [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version format"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies and build
run: yarn && yarn build
- name: Build and Publish
run: |
cd packages/${{ github.event.inputs.packageName }}
yarn npm publish --tag ${{ github.event.inputs.version }} --access public --otp ${{ secrets.NPM_TOKEN }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
token: ${{ secrets.NPM_TOKEN }}