diff --git a/.github/workflows/deploy-goerli.yml b/.github/workflows/deploy-goerli.yml new file mode 100644 index 0000000..99137c1 --- /dev/null +++ b/.github/workflows/deploy-goerli.yml @@ -0,0 +1,47 @@ +name: Deploy Sleuth [Goerli] + +on: + pull_request: + workflow_dispatch: + inputs: + deployer_address: + description: WalletConnect address to deploy from + required: true + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Deploy Sleuth [Goerli] + runs-on: ubuntu-latest + steps: + - name: Start Seacrest + uses: hayesgm/seacrest@v1 + with: + ethereum_url: "${{ secrets.ETH_GOERLI_URL }}" + requested_network: 5 + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + + - name: Forge Deploy Sleuth [Goerli] + run: script/ethereum/deploy.sh + env: + GOERLI_API_KEY: "${{ secrets.GOERLI_API_KEY }}" + ETH_FROM: "${{ inputs.deployer_address }}" + RPC_URL: "http://localhost:8585" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-mainnet.yml similarity index 96% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-mainnet.yml index ed9c251..1c27ee1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-mainnet.yml @@ -38,7 +38,7 @@ jobs: forge build --sizes - name: Forge Deploy Sleuth [Mainnet] - run: script/mainnet/deploy.sh + run: script/ethereum/deploy.sh env: ETHERSCAN_API_KEY: "${{ secrets.ETHERSCAN_API_KEY }}" ETH_FROM: "${{ inputs.deployer_address }}" diff --git a/.github/workflows/deploy-polygon.yml b/.github/workflows/deploy-polygon.yml new file mode 100644 index 0000000..30fcf31 --- /dev/null +++ b/.github/workflows/deploy-polygon.yml @@ -0,0 +1,47 @@ +name: Deploy Sleuth [Polygon] + +on: + pull_request: + workflow_dispatch: + inputs: + deployer_address: + description: WalletConnect address to deploy from + required: true + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Deploy Sleuth [Polygon] + runs-on: ubuntu-latest + steps: + - name: Start Seacrest + uses: hayesgm/seacrest@v1 + with: + ethereum_url: "${{ secrets.ETH_POLYGON_URL }}" + requested_network: 137 + + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + + - name: Forge Deploy Sleuth [Polygon] + run: script/polygon/deploy.sh + env: + POLYGON_API_KEY: "${{ secrets.POLYGON_API_KEY }}" + ETH_FROM: "${{ inputs.deployer_address }}" + RPC_URL: "http://localhost:8585" diff --git a/script/mainnet/deploy.sh b/script/ethereum/deploy.sh similarity index 100% rename from script/mainnet/deploy.sh rename to script/ethereum/deploy.sh diff --git a/script/polygon/deploy.sh b/script/polygon/deploy.sh new file mode 100755 index 0000000..6a8e4de --- /dev/null +++ b/script/polygon/deploy.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -exo pipefail + +if [ -n "$ETHEREUM_PK" ]; then + wallet_args="--private-key $ETHEREUM_PK" +else + wallet_args="--unlocked" +fi + +if [ -n "$RPC_URL" ]; then + rpc_args="--rpc-url $RPC_URL" +else + rpc_args="" +fi + +if [ -n "$POLYGON_API_KEY" ]; then + etherscan_args="--verify --etherscan-api-key $POLYGON_API_KEY" +else + etherscan_args="" +fi + +forge create \ + $rpc_args \ + $etherscan_args \ + $wallet_args \ + $@ \ + src/Sleuth.sol:Sleuth +s \ No newline at end of file