#!/bin/bash set -e # ๐Ÿšช Move into the NPM project directory cd "$(dirname "$0")/source" # ๐Ÿ” Load secrets from root .env echo "๐Ÿ“ฆ Loading .env from root dir" export $(grep -v '^#' ../.env | xargs) # ๐Ÿงผ Clean (optional) echo "๐Ÿงน Cleaning dist (if exists)..." rm -rf dist || true # ๐Ÿ› ๏ธ Build if tsc is present if npx --no-install tsc --version > /dev/null 2>&1; then echo "๐Ÿ› ๏ธ Building with tsc..." npx tsc else echo "โš ๏ธ No TypeScript build step found. Skipping..." fi # ๐Ÿš€ Publish to Gitea registry using token from .env echo "๐Ÿš€ Publishing to Gitea NPM registry..." npm publish \ --registry=https://git.chipperfluff.at/api/packages/projects/npm/ \ --//git.chipperfluff.at/api/packages/projects/npm/:_authToken="$NPM_TOKEN"