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
This commit is contained in:
sripwoud
2024-11-26 15:21:07 +07:00
committed by GitHub
parent ebd9a27c1b
commit 91f8a4be2a
2 changed files with 6 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- "v*"

View File

@@ -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"
})