-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: publish contracts to soldeer (#820)
* chore: define separate version.ts script * chore: include publishing to soldeer in script * fix(contracts): push to soldeer re 800 * ci: fetch latest contract version from soldeer * refactor: do not use execa in scripts * fix: do not exit process in script * chore: remove comments * refactor: use shebang in ts scripts * chore(contracts): add soldeerignore * chore: inherit stdio in scripts * chore: remove dry run flag * chore: uncomment * chore: fix typo in comment
- Loading branch information
Showing
11 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,3 +94,5 @@ typechain-types | |
|
||
# Other | ||
snark-artifacts | ||
|
||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!node_modules/.bin/ts-node | ||
import { readdirSync, rmSync } from "fs" | ||
|
||
const folderName = "apps" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!node_modules/.bin/ts-node | ||
import { rmSync } from "fs" | ||
|
||
const folderName = "packages" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!node_modules/.bin/ts-node | ||
import { readdirSync, rmSync } from "fs" | ||
|
||
const folderName = "packages" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!node_modules/.bin/ts-node | ||
import compare from "semver/functions/compare" | ||
import { execSync } from "child_process" | ||
import contractsPkgJson from "@semaphore-protocol/contracts/package.json" | ||
|
||
const { version: contractsLocalVersion } = contractsPkgJson | ||
|
||
async function maybePushToSoldeer() { | ||
// api not documented, may change, found by inspecting the network tab | ||
const response = await fetch( | ||
"https://api.soldeer.xyz/api/v1/revision?project_name=semaphore-protocol-contracts&limit=1" | ||
) | ||
const { data, status } = await response.json() | ||
|
||
// fail status if no version published at all yet | ||
if (status === "fail" || compare(contractsLocalVersion, data[0].version) === 1) | ||
execSync(`soldeer push semaphore-protocol-contracts~${contractsLocalVersion} packages/contracts/contracts`, { | ||
stdio: "inherit" | ||
}) | ||
} | ||
|
||
async function main() { | ||
execSync(`yarn build:libraries`, { stdio: "inherit" }) | ||
execSync(`yarn clean:cli-templates`) | ||
execSync(`yarn workspaces foreach -A --no-private npm publish --tolerate-republish --access public`, { | ||
stdio: "inherit" | ||
}) | ||
|
||
await maybePushToSoldeer() | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!node_modules/.bin/ts-node | ||
import { execSync } from "child_process" | ||
|
||
async function main() { | ||
const version = process.argv[2] | ||
|
||
// Perform the workspaces version update | ||
execSync(`yarn workspaces foreach -A --no-private version -d ${version}`, { stdio: "inherit" }) | ||
|
||
// Apply the versions | ||
execSync("yarn version apply --all", { stdio: "inherit" }) | ||
|
||
await import("./remove-stable-version-field") | ||
|
||
execSync("yarn format:write") | ||
execSync(`NO_HOOK=1 git commit -am 'chore: v${version}'`) | ||
execSync(`git tag v${version}`) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters