The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hyperlane-monorepo/solidity/exportBuildArtifact.sh

35 lines
1003 B

#!/bin/sh
# set script location as working directory
cd "$(dirname "$0")"
# Define the artifacts directory
artifactsDir="./artifacts/build-info"
# Define the output file
outputFile="./buildArtifact.json"
# log that we're in the script
echo 'Finding and processing hardhat build artifact...'
# Find most recently modified JSON build artifact
if [[ $OSTYPE == 'darwin'* ]]; then
# for local flow
jsonFiles=$(find "$artifactsDir" -type f -name "*.json" -exec stat -f "%m %N" {} \; | sort -rn | head -n 1 | cut -d' ' -f2-)
else
# for CI flow
jsonFiles=$(find "$artifactsDir" -type f -name "*.json" -exec stat -c "%Y %n" {} \; | sort -rn | head -n 1 | cut -d' ' -f2-)
fi
if [[ ! -f "$jsonFiles" ]]; then
echo 'Failed to find build artifact'
exit 1
fi
# Extract required keys and write to outputFile
if jq -c '{input, solcLongVersion}' "$jsonFiles" > "$outputFile"; then
echo 'Finished processing build artifact.'
else
echo 'Failed to process build artifact with jq'
exit 1
fi