61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
name: Publicar Paquete SigPro (NPM)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:20-bullseye
|
|
options: >-
|
|
--dns 192.168.1.1
|
|
--add-host git.natxocc.com:host-gateway
|
|
--add-host gitea:host-gateway
|
|
|
|
steps:
|
|
- name: Checkout código
|
|
uses: actions/checkout@v4
|
|
env:
|
|
GIT_CONFIG_PARAMETERS: "'url.https://git.natxocc.com/.insteadOf=http://gitea:3000/'"
|
|
|
|
- name: Instalar Bun
|
|
run: |
|
|
curl -fsSL https://bun.sh/install | bash
|
|
echo "$HOME/.bun/bin" >> $GITHUB_PATH
|
|
|
|
- name: Instalar dependencias
|
|
run: |
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
bun install
|
|
|
|
- name: Ejecutar Build
|
|
run: |
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
bun run build
|
|
|
|
- name: Publicar vía API (Gitea 1.25.x)
|
|
run: |
|
|
# 1. Crear el paquete .tgz
|
|
npm pack
|
|
|
|
# 2. Capturar el nombre del archivo generado
|
|
TARBALL_NAME=$(ls sigpro-*.tgz | head -n 1)
|
|
echo "Subiendo archivo: $TARBALL_NAME"
|
|
|
|
# 3. Publicación mediante PUT Binario
|
|
# En Gitea 1.25, para paquetes NPM sin scope, la URL es:
|
|
# /api/packages/{owner}/npm
|
|
# SIN barra final.
|
|
curl -v -X PUT \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@${TARBALL_NAME}" \
|
|
"https://git.natxocc.com/api/packages/natxocc/npm" |