From 91f8a4be2a726bbc3526075d1353f57da67b91a7 Mon Sep 17 00:00:00 2001 From: sripwoud Date: Tue, 26 Nov 2024 15:21:07 +0700 Subject: [PATCH] fix(ci): publish pkg if no releases yet (#900) * fix(ci): publish pkg if no releases yet * chore(ci): add workflow release trigger * fix: workflow dispatch instead of workflow release --- .github/workflows/release.yml | 1 + scripts/publish.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 696b6ac0f..c3217aeea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ permissions: contents: write on: + workflow_dispatch: push: tags: - "v*" diff --git a/scripts/publish.ts b/scripts/publish.ts index 766fc8349..b3676c2f5 100755 --- a/scripts/publish.ts +++ b/scripts/publish.ts @@ -10,10 +10,12 @@ async function maybePushToSoldeer() { const response = await fetch( "https://api.soldeer.xyz/api/v1/revision?project_name=semaphore-protocol-contracts&limit=1" ) - const { data, status } = await response.json() + const { data } = await response.json() - // fail status if no version published at all yet - if (status === "fail" || compare(contractsLocalVersion, data[0].version) === 1) + if ( + data.length === 0 || // data = [] if no version has ever been published yet + compare(contractsLocalVersion, data[0].version) === 1 + ) execSync(`soldeer push semaphore-protocol-contracts~${contractsLocalVersion} packages/contracts/contracts`, { stdio: "inherit" })