Skip to content

Commit

Permalink
refactor: move scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
superical committed Mar 26, 2024
1 parent 4e3349d commit 2146c49
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Build types for ${{ env.MATRIX_TARGET }}
run: |
echo "Generating types for ${{ env.MATRIX_TARGET }}"
./build.sh typechain ${{ env.MATRIX_TARGET }}
./bin/build.sh typechain ${{ env.MATRIX_TARGET }}
- name: Upload type targets
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
[
"@semantic-release/exec",
{
"publishCmd": "sh ./build.sh publish ${nextRelease.version}"
"publishCmd": "sh ./bin/build.sh publish ${nextRelease.version}"
}
],
"@semantic-release/github"
Expand Down
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

if [ "$#" -lt 4 ]; then
echo "Usage: $0 network sender verify script_name [sig] [sig_params...]"
exit 1
fi

NETWORK=$1
SENDER=$2
VERIFY=$3
SCRIPT=$4

# Check if the SIG which is $5 is provided and if it is then include SIG_PARAMS too
if [[ "$5" != "" && "$5" != -* ]]; then
SIG=$5
shift 5
SIG_PARAMS=("$@")
fi

# forge command
COMMAND="forge script \"$SCRIPT\" --broadcast -i 1 -f \"$NETWORK\" --sender \"$SENDER\""

if [ "$VERIFY" -eq 1 ]; then
COMMAND="$COMMAND --verify"
fi

if [ ! -z "$SIG" ]; then
COMMAND="$COMMAND -s \"$SIG\""
if [ ! -z "${SIG_PARAMS[*]}" ]; then
for PARAM in "${SIG_PARAMS[@]}"; do
COMMAND="$COMMAND \"$PARAM\""
done
fi
fi

eval $COMMAND
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"prettier:check": "npx prettier --check \"**/*.{json,md,yml,sol}\" \"!broadcast/**/*\" --ignore-path=.prettierignore",
"prettier:write": "npx prettier --write \"**/*.{json,md,yml,sol}\" \"!broadcast/**/*\" --ignore-path=.prettierignore",
"test": "forge test",
"test:coverage": "npm run clean && ./coverage.sh",
"deploy": "./deploy.sh $npm_config_network $npm_config_sender $npm_config_verify",
"test:coverage": "npm run clean && ./bin/coverage.sh",
"deploy": "./bin/deploy.sh $npm_config_network $npm_config_sender $npm_config_verify",
"deploy:ds": "npm run -s deploy script/DocumentStore.s.sol:DocumentStoreScript \"run(string,address)\" \"$npm_config_name\" \"$npm_config_admin\"",
"deploy:ds:impl": "npm run -s deploy script/DocumentStoreInitializable.s.sol:DocumentStoreInitializableScript",
"deploy:ds:upgradeable": "npm run -s deploy script/DocumentStoreUpgradeable.s.sol:DocumentStoreUpgradeableScript \"run(string,address)\" \"$npm_config_name\" \"$npm_config_admin\"",
Expand Down

0 comments on commit 2146c49

Please sign in to comment.