summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-07-27 22:25:21 -0700
committerElizabeth Hunt <me@liz.coffee>2025-07-27 22:36:34 -0700
commitec73128cd816c9d109dce9189823c4f7eec69d0d (patch)
tree84af9024480ab2d2446daadf39870f922ca136bf
parent54a5b84522e970837ef4cc5e1f6533b18229babf (diff)
downloadci-ec73128cd816c9d109dce9189823c4f7eec69d0d.tar.gz
ci-ec73128cd816c9d109dce9189823c4f7eec69d0d.zip
Fixes NPM publish script
-rw-r--r--packpub/npm/Dockerfile2
-rw-r--r--worker/scripts/npm_publish.ts17
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;
}),