Skip to content

Commit

Permalink
use try in publish skip
Browse files Browse the repository at this point in the history
  • Loading branch information
Rekard0 committed Feb 18, 2025
1 parent c413eab commit f8522d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
28 changes: 16 additions & 12 deletions packages/contracts/deploy/20_new_version/23_publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,20 +240,24 @@ func.skip = async (hre: HardhatRuntimeEnvironment) => {
throw `PluginRepo '${pluginEnsDomain(hre)}' does not exist yet.`;
}

const pastVersions = await getPastVersionCreatedEvents(pluginRepo);
try {
const pastVersions = await getPastVersionCreatedEvents(pluginRepo);

// Check if the version was published already
const filteredLogs = pastVersions.filter(
items =>
items.event.args.release === VERSION.release &&
items.event.args.build === VERSION.build
);

if (filteredLogs.length !== 0) {
console.log(
`Build number ${VERSION.build} has already been published for release ${VERSION.release}. Skipping publication...`
// Check if the version was published already
const filteredLogs = pastVersions.filter(
items =>
items.event.args.release === VERSION.release &&
items.event.args.build === VERSION.build
);
return true;

if (filteredLogs.length !== 0) {
console.log(
`Build number ${VERSION.build} has already been published for release ${VERSION.release}. Skipping publication...`
);
return true;
}
} catch (error) {
console.log(`Error in geting previouse version ${error}.`);
}

return false;
Expand Down
7 changes: 5 additions & 2 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ const config: HardhatUserConfig = {
polygon: process.env.POLYGONSCAN_API_KEY || '',
base: process.env.BASESCAN_API_KEY || '',
arbitrumOne: process.env.ARBISCAN_API_KEY || '',
peaq: process.env.PEAQ_KEY || '',
agungTestnet: process.env.PEAQ_KEY || '',
},
customChains: [
{
Expand All @@ -170,15 +172,16 @@ const config: HardhatUserConfig = {
network: 'agungTestnet', // Peaq testnet
chainId: 9990,
urls: {
apiURL: 'https://wss-async.agung.peaq.network',
apiURL:
'https://agung-testnet.subscan.io/api/scan/evm/contract/verify',
browserURL: 'https://agung-testnet.subscan.io/',
},
},
{
network: 'peaq', // Peaq mainnet
chainId: 3338,
urls: {
apiURL: 'https://erpc-mpfn1.peaq.network',
apiURL: '',
browserURL: 'https://peaq.subscan.io/',
},
},
Expand Down

0 comments on commit f8522d2

Please sign in to comment.