54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: Publicar Paquete SigPro (NPM)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
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: Build y Preparación
|
|
run: |
|
|
export PATH="$HOME/.bun/bin:$PATH"
|
|
bun install
|
|
bun run build
|
|
|
|
# Cambiamos el nombre en package.json temporalmente para que Gitea lo acepte
|
|
# de "sigpro" a "@natxocc/sigpro"
|
|
sed -i 's/"name": "sigpro"/"name": "@natxocc\/sigpro"/' package.json
|
|
|
|
# Creamos el paquete .tgz
|
|
npm pack
|
|
|
|
- name: Publicar vía API (PUT Directo)
|
|
run: |
|
|
TARBALL_NAME=$(ls natxocc-sigpro-*.tgz | head -n 1)
|
|
|
|
# La URL oficial de Gitea para publicar paquetes NPM es esta:
|
|
# https://git.natxocc.com/api/packages/natxocc/npm/
|
|
|
|
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/" |