From ec73128cd816c9d109dce9189823c4f7eec69d0d Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 27 Jul 2025 22:25:21 -0700 Subject: Fixes NPM publish script --- packpub/npm/Dockerfile | 2 +- worker/scripts/npm_publish.ts | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packpub/npm/Dockerfile b/packpub/npm/Dockerfile index 48abf1b..c179655 100644 --- a/packpub/npm/Dockerfile +++ b/packpub/npm/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stable-slim AS ci_packpub_npm +FROM debian:stable-slim AS packpub_npm RUN apt-get update \ && apt-get -y --no-install-recommends install \ diff --git a/worker/scripts/npm_publish.ts b/worker/scripts/npm_publish.ts index f97ee48..d0fcc68 100644 --- a/worker/scripts/npm_publish.ts +++ b/worker/scripts/npm_publish.ts @@ -3,13 +3,13 @@ import { Either, getRequiredEnvVars, - getStdout, type IEither, LogTraceable, LogMetricTraceable, Metric, prependWith, TraceUtil, + getStdoutMany, } from '@emprespresso/pengueno'; import { Bitwarden, getPathOnHost, type SecureNote } from '@emprespresso/ci_worker'; import { writeFile, mkdir } from 'fs/promises'; @@ -27,6 +27,10 @@ const eitherJob = getRequiredEnvVars(['source', 'registry']).mapRight( const eitherVault = Bitwarden.getConfigFromEnvironment().mapRight((config) => new Bitwarden(config)); +const READONLY_CREDENTIALS = { username: 'readonly', password: 'readonly' }; +const REGISTRY = 'oci.liz.coffee'; +const CI_PACKPUB_IMG = 'oci.liz.coffee/emprespresso/ci_packpub_npm'; + const packPubMetric = Metric.fromName('npm_publish.packpub'); const _logJob = LogTraceable.of(eitherJob).flatMap(TraceUtil.withTrace('npm_publish')); await LogMetricTraceable.ofLogTraceable(_logJob) @@ -65,16 +69,15 @@ await LogMetricTraceable.ofLogTraceable(_logJob) ); const volumes = [`${srcMount}:/src`, `${npmRcMount}:/etc/npmrc`]; const packPub = [ - 'docker', - 'run', - ...prependWith(volumes, '-v'), - 'oci.liz.coffee/emprespresso/ci_packpub_npm:release', - ]; + `docker login --username ${READONLY_CREDENTIALS.username} --password ${READONLY_CREDENTIALS.password} ${REGISTRY}`.split( + ' ', + ), + ].concat(['docker', 'run', ...prependWith(volumes, '-v'), CI_PACKPUB_IMG + ':release']); tEitherJobNpmRc.trace.trace(`running packpub magic~ (◕ᴗ◕✿) ${packPub}`); return tEitherJobNpmRc .move(packPub) .map((c) => - getStdout(c, { streamTraceable: ['stdout', 'stderr'] }).then((e) => { + getStdoutMany(c, { streamTraceable: ['stdout', 'stderr'] }).then((e) => { rmSync(npmRcMount!); return e; }), -- cgit v1.2.3-70-g09d2