fix(devops): derive gitea publish auth target from registry url
This commit is contained in:
parent
178f043518
commit
6d5450d9f7
@ -5,6 +5,8 @@ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|||||||
PACKAGES_DIR="$REPO_ROOT/packages"
|
PACKAGES_DIR="$REPO_ROOT/packages"
|
||||||
TMP_DIR="${TMPDIR:-/tmp}/bytelyst-gitea-publish"
|
TMP_DIR="${TMPDIR:-/tmp}/bytelyst-gitea-publish"
|
||||||
REGISTRY_URL="${GITEA_NPM_REGISTRY_URL:-http://localhost:3300/api/packages/bytelyst/npm/}"
|
REGISTRY_URL="${GITEA_NPM_REGISTRY_URL:-http://localhost:3300/api/packages/bytelyst/npm/}"
|
||||||
|
AUTH_TARGET="${REGISTRY_URL#http://}"
|
||||||
|
AUTH_TARGET="${AUTH_TARGET#https://}"
|
||||||
TOKEN="${GITEA_NPM_TOKEN:-}"
|
TOKEN="${GITEA_NPM_TOKEN:-}"
|
||||||
PACKAGE_FILTER="${1:-}"
|
PACKAGE_FILTER="${1:-}"
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ publish_package() {
|
|||||||
echo "🚀 Publishing $package_name@$package_version to $REGISTRY_URL"
|
echo "🚀 Publishing $package_name@$package_version to $REGISTRY_URL"
|
||||||
if ! npm publish "$final_tgz" \
|
if ! npm publish "$final_tgz" \
|
||||||
--registry "$REGISTRY_URL" \
|
--registry "$REGISTRY_URL" \
|
||||||
--//localhost:3300/api/packages/bytelyst/npm/:_authToken="$TOKEN"; then
|
--"//${AUTH_TARGET}:_authToken=$TOKEN"; then
|
||||||
echo "⚠️ Publish failed for $package_name@$package_version (possibly already published)"
|
echo "⚠️ Publish failed for $package_name@$package_version (possibly already published)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user