63 lines
1.9 KiB
YAML
63 lines
1.9 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: Configurar Registro Gitea y Publicar
|
|
run: |
|
|
# 1. Definimos la URL exacta del registro (sin protocolo para el token)
|
|
REGISTRY_URL="git.natxocc.com/api/packages/natxocc/npm/"
|
|
|
|
# 2. Limpiamos cualquier .npmrc previo para evitar conflictos
|
|
rm -f .npmrc ~/.npmrc
|
|
|
|
# 3. Creamos la configuración de autenticación manual
|
|
# Importante: Usamos GITEA_TOKEN (tu PAT) y forzamos always-auth
|
|
echo "//${REGISTRY_URL}:_authToken=${{ secrets.GITEA_TOKEN }}" > ~/.npmrc
|
|
echo "//${REGISTRY_URL}:always-auth=true" >> ~/.npmrc
|
|
|
|
# 4. Configuramos el registro por defecto para esta sesión de npm
|
|
npm config set registry "https://${REGISTRY_URL}"
|
|
|
|
# 5. Publicamos
|
|
# Usamos --userconfig para asegurar que use el archivo que acabamos de crear
|
|
# Usamos --ignore-scripts para evitar que el 'prepublishOnly' vuelva a lanzar el build de Bun
|
|
npm publish --userconfig ~/.npmrc --ignore-scripts |