diff --git a/.github/workflows/jsr-publish.yml b/.github/workflows/jsr-publish.yml index 871779e..d7fe3bd 100644 --- a/.github/workflows/jsr-publish.yml +++ b/.github/workflows/jsr-publish.yml @@ -27,13 +27,13 @@ jobs: - name: Publish libs/ts/assert-never working-directory: libs/ts/assert-never - run: deno run --allow-read --allow-net ../jsr-metadata/local-version-is-newer.deno.ts && npx jsr publish + run: deno run --allow-read --allow-net --allow-run ../jsr-metadata/publish-if-local-version-is-newer.deno.ts - name: Publish libs/ts/date working-directory: libs/ts/date - run: deno run --allow-read --allow-net ../jsr-metadata/local-version-is-newer.deno.ts && npx jsr publish + run: deno run --allow-read --allow-net --allow-run ../jsr-metadata/publish-if-local-version-is-newer.deno.ts - name: Publish libs/ts/detect-runtime working-directory: libs/ts/detect-runtime - run: deno run --allow-read --allow-net ../jsr-metadata/local-version-is-newer.deno.ts && npx jsr publish + run: deno run --allow-read --allow-net --allow-run ../jsr-metadata/publish-if-local-version-is-newer.deno.ts \ No newline at end of file diff --git a/libs/ts/assert-never/jsr.json b/libs/ts/assert-never/jsr.json index eb00a98..c0464ce 100644 --- a/libs/ts/assert-never/jsr.json +++ b/libs/ts/assert-never/jsr.json @@ -1,5 +1,5 @@ { "name": "@axhxrx/assert-never", - "version": "0.1.7", + "version": "0.1.8", "exports": "./mod.ts" } \ No newline at end of file diff --git a/libs/ts/jsr-metadata/local-version-is-newer.deno.ts b/libs/ts/jsr-metadata/publish-if-local-version-is-newer.deno.ts similarity index 78% rename from libs/ts/jsr-metadata/local-version-is-newer.deno.ts rename to libs/ts/jsr-metadata/publish-if-local-version-is-newer.deno.ts index 423edcb..9fba4de 100644 --- a/libs/ts/jsr-metadata/local-version-is-newer.deno.ts +++ b/libs/ts/jsr-metadata/publish-if-local-version-is-newer.deno.ts @@ -71,10 +71,29 @@ console.log('JSR version is old:', isOld); if (!isOld) { console.log('Doing nothing and exiting with exit status 1'); - Deno.exit(1); + Deno.exit(0); } else { - console.log('Will exit with status 0'); + console.log('🚀🚀🚀 PUBLISHING... '); + const publishCommand = new Deno.Command("npx", { + args: ["jsr", "publish"], + stdout: "piped", + stderr: "piped", + }); + + const { code, stdout, stderr } = await publishCommand.output(); + + if (code === 0) { + console.log('✅ Published successfully!'); + } else { + console.error('❌ Failed to publish.'); + const errorString = new TextDecoder().decode(stderr); + console.error(errorString); + const outputString = new TextDecoder().decode(stdout); + console.log(outputString); + Deno.exit(code); + } + Deno.exit(0); }