Skip to content

Commit

Permalink
Get set-up for simple deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Mar 16, 2024
1 parent 3b70f75 commit 549e156
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 5 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy Release

on:
push:
workflow_dispatch:
inputs:
release:
name: release
description: Release tag (e.g. v0.0.1)

network:
name: network
options:
- mainnet
- sepolia
- base
- base_sepolia

env:
FOUNDRY_PROFILE: ci

permissions:
contents: write

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Deploy Release
run: |
export RPC_URL=$(echo $deployer_config | jq ".$network.rpc_url")
export DEPLOYER_PK=$(echo $deployer_config | jq ".$network.deployer_pk")
script/deploy-release.sh $tag
env:
deployer_config: ${{ secrets.deployer_config }}
network: sepolia
tag: v0.0.1

- uses: ncipollo/release-action@v1
with:
artifacts: "release/Sleuth.json,release/Sleuth.sol,release/contracts.json,release/sleuth@*"
bodyFile: "release/RELEASE.md"
allowUpdates: true
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Sleuth [Mainnet]
name: Deploy Sleuth [Mainnet - WalletConnect]

on:
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ jobs:
- name: Prepare Release
run: |
export RPC_URL=$(echo $deployer_config | jq ".$network.rpc_url")
export CODE_JAR=$(echo $deployer_config | jq ".$network.code_jar")
script/prepare-release.sh
env:
CODE_JAR: ${{ vars.CODE_JAR }}
RPC_URL: ${{ vars.SEPOLIA_RPC_URL }}
deployer_config: ${{ secrets.deployer_config }}
network: sepolia

- uses: ncipollo/release-action@v1
with:
Expand Down
21 changes: 19 additions & 2 deletions script/deploy-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ if [ -z "$tag" ]; then
exit 1
fi

opts=""

if [ -n "$DEPLOYER_PK" ]; then
opts="$opts --private-key $DEPLOYER_PK --broadcast"
fi

if [ -n "$ETHERSCAN_API_KEY" ]; then
opts="$opts --verify --etherscan-api-key \"$ETHERSCAN_API_KEY\""
fi

cleanup() {
rv=$?
rm -rf .release-tmp
exit $rv
}

trap "cleanup" EXIT

rm -rf .release-tmp
mkdir .release-tmp

Expand All @@ -30,7 +48,6 @@ export CODE_JAR="$(cat ./.release-tmp/contracts.json | jq -r '.codeJar')"

forge script \
--rpc-url="$RPC_URL" \
$opts \
script/Sleuth.s.sol:Deploy \
$@

# TODO: Verify

0 comments on commit 549e156

Please sign in to comment.