Skip to content

Commit

Permalink
🩹 fix bug in publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
protiev committed Jun 16, 2024
1 parent 75f4ede commit 026e107
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/jsr-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
with:
deno-version: v1.x

- name: Publish libs/ts/assert-never
- name: Publish libs/ts/assert-never if needed...
working-directory: libs/ts/assert-never
run: deno run --allow-read --allow-net --allow-run ../jsr-metadata/publish-if-local-version-is-newer.deno.ts

- name: Publish libs/ts/date
- name: Publish libs/ts/date if needed...
working-directory: libs/ts/date
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
- name: Publish libs/ts/detect-runtime if needed...
working-directory: libs/ts/detect-runtime
run: deno run --allow-read --allow-net --allow-run ../jsr-metadata/publish-if-local-version-is-newer.deno.ts

13 changes: 7 additions & 6 deletions libs/ts/jsr-metadata/publish-if-local-version-is-newer.deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const firstArg = Deno.args[0];
const secondArg = Deno.args[1];
const thirdArg = Deno.args[2];

let scopeName: JsrScopeName;
let packageName: string;
let scopeName: string = 'axhxrx';
let packageName = 'WTF_NONEXISTENT_BRO_WTF';
let localVersionString: string;

if (firstArg && secondArg && thirdArg)
Expand Down Expand Up @@ -41,6 +41,7 @@ else
localVersionString = localJsrMetadataJson.version;
}


if (!localVersionString)
{
throw new Error(`No version found in "${cwd}/jsr.json"...`);
Expand All @@ -53,18 +54,18 @@ if (typeof localVersionString !== 'string' || localVersionString.length < 5
}
console.log(`Local version: ${localVersionString}`);

import { jsrMetadataFetch, JsrScopeName, jsrVersionIsOlderThan } from './mod.ts';
import { jsrMetadataFetch, jsrVersionIsOlderThan } from './mod.ts';

const remoteMetadata = await jsrMetadataFetch('@axhxrx', 'date');
const remoteMetadata = await jsrMetadataFetch(`@${scopeName}`, packageName);

if (!remoteMetadata)
{
throw new Error(`No metadata found for "@axhxrx/date"...`);
throw new Error(`No metadata found for "@${scopeName}/${packageName}"...`);
}

console.log(`Remote version: ${remoteMetadata.latest}`);

const isOld = await jsrVersionIsOlderThan('@axhxrx', 'date', localVersionString, remoteMetadata);
const isOld = await jsrVersionIsOlderThan(`@${scopeName}`, packageName, localVersionString, remoteMetadata);

console.log('JSR version is old:', isOld);

Expand Down

0 comments on commit 026e107

Please sign in to comment.