Skip to content

Commit 3468375

Browse files
committed
2 parents fcc346f + 956d5b4 commit 3468375

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/main.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: NPM Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Tipo de liberación'
8+
required: true
9+
default: 'Publicación desde package.json'
10+
type: choice
11+
options:
12+
- 'Publicación desde package.json'
13+
14+
jobs:
15+
build-and-publish:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '18'
25+
registry-url: 'https://registry.npmjs.org/'
26+
27+
- name: Get package version
28+
id: package-version
29+
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
35+
36+
- name: Build package
37+
run: npm run build
38+
39+
- name: Verify build artifacts
40+
run: |
41+
if [ ! -d "dist/cjs" ]; then
42+
echo "CommonJS build missing"
43+
exit 1
44+
fi
45+
if [ ! -d "dist/esm" ]; then
46+
echo "ESM build missing"
47+
exit 1
48+
fi
49+
if [ ! -d "dist/types" ]; then
50+
echo "TypeScript definitions missing"
51+
exit 1
52+
fi
53+
54+
- name: Publish to NPM
55+
run: npm publish --access public
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
58+
npm_config_//registry.npmjs.org/:_authToken: ${{ secrets.NPM_TOKEN }}
59+
npm_config_email: ${{ secrets.NPM_USER }}

0 commit comments

Comments
 (0)