docs: adding notes for 2.8.0 #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- dev | |
jobs: | |
deploy_to_testnets_on_merge: | |
env: | |
DEFENDER_TEAM_API_KEY: ${{ secrets.DEFENDER_TEAM_API_KEY }} | |
DEFENDER_TEAM_API_SECRET_KEY: ${{ secrets.DEFENDER_TEAM_API_SECRET_KEY }} | |
DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} | |
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} | |
GOERLI_BADGES_ADDRESS: ${{ secrets.GOERLI_BADGES_ADDRESS }} | |
GOERLI_GNOSIS_SAFE: ${{ secrets.GOERLI_GNOSIS_SAFE }} | |
GOERLI_RAFT_ADDRESS: ${{ secrets.GOERLI_RAFT_ADDRESS }} | |
GOERLI_RPC_URL: ${{ secrets.GOERLI_RPC_URL }} | |
GOERLI_SPECDATAHOLDER_ADDRESS: ${{ secrets.GOERLI_SPECDATAHOLDER_ADDRESS }} | |
OPTIMISM_GOERLI_BADGES_ADDRESS: ${{ secrets.OPTIMISM_GOERLI_BADGES_ADDRESS }} | |
OPTIMISM_GOERLI_RAFT_ADDRESS: ${{ secrets.OPTIMISM_GOERLI_RAFT_ADDRESS }} | |
OPTIMISM_GOERLI_RPC_URL: ${{ secrets.OPTIMISM_GOERLI_RPC_URL }} | |
OPTIMISM_GOERLI_SPECDATAHOLDER_ADDRESS: ${{ secrets.OPTIMISM_GOERLI_SPECDATAHOLDER_ADDRESS }} | |
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }} | |
OPTIMISTIC_ETHERSCAN_API_KEY: ${{ secrets.OPTIMISTIC_ETHERSCAN_API_KEY }} | |
SEPOLIA_BADGES_ADDRESS: ${{ secrets.SEPOLIA_BADGES_ADDRESS }} | |
SEPOLIA_RAFT_ADDRESS: ${{ secrets.SEPOLIA_RAFT_ADDRESS }} | |
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} | |
SEPOLIA_SPECDATAHOLDER_ADDRESS: ${{ secrets.SEPOLIA_SPECDATAHOLDER_ADDRESS }} | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: yarn | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Install submodules | |
run: git submodule update --init | |
- name: Install yarn dependencies | |
run: yarn | |
- name: Run forge install | |
run: forge install | |
- name: Deploy | |
run: | | |
set -e | |
prev_tag=$(git describe --tags --abbrev=0) | |
echo "PREVIOUS TAG = $prev_tag" | |
git branch prev_tag $prev_tag | |
git switch prev_tag | |
badges_code_at_prev_tag=$(cat src/Badges.sol) | |
raft_code_at_prev_tag=$(cat src/Raft.sol) | |
sdh_code_at_prev_tag=$(cat src/SpecDataHolder.sol) | |
git switch dev | |
latest_badges_code=$(cat src/Badges.sol) | |
latest_raft_code=$(cat src/Raft.sol) | |
latest_sdh_code=$(cat src/SpecDataHolder.sol) | |
declare -A networks=( | |
["goerli"]="$GOERLI_RPC_URL $ETHERSCAN_API_KEY" | |
["optimism-goerli"]="$OPTIMISM_GOERLI_RPC_URL $OPTIMISTIC_ETHERSCAN_API_KEY" | |
["sepolia"]="$SEPOLIA_RPC_URL $ETHERSCAN_API_KEY" | |
) | |
for networkName in "${!networks[@]}"; do | |
read rpc_url etherscan_api_key <<<"${networks[$networkName]}" | |
# Initialize the list of successfully deployed contracts | |
deployedContracts=() | |
if [ "$badges_code_at_prev_tag" != "$latest_badges_code" ]; then | |
implementationAddress=$(forge create src/Badges.sol:Badges --private-key "$DEPLOYER_PRIVATE_KEY" --verify --rpc-url "$rpc_url" --etherscan-api-key "$etherscan_api_key" | grep "Deployed to:" | cut -d " " -f 3) || { | |
echo "Failed to deploy the new Badges implementation on $networkName" | |
exit 1 | |
} | |
echo "Badges contract deployed. implementationAddress: $implementationAddress" | |
node scripts/createProposal.js "$implementationAddress" 'badges' "$networkName" || { | |
echo "Failed to create a proposal for the new Badges implementation on $networkName" | |
exit 1 | |
} | |
# Add the contract name to the deployedContracts list | |
deployedContracts+=("Badges") | |
fi | |
if [ "$raft_code_at_prev_tag" != "$latest_raft_code" ]; then | |
implementationAddress=$(forge create src/Raft.sol:Raft --private-key "$DEPLOYER_PRIVATE_KEY" --verify --rpc-url "$rpc_url" --etherscan-api-key "$etherscan_api_key" | grep "Deployed to:" | cut -d " " -f 3) || { | |
echo "Failed to deploy the new Raft implementation on $networkName" | |
exit 1 | |
} | |
echo "Raft contract deployed. implementationAddress: $implementationAddress" | |
node scripts/createProposal.js "$implementationAddress" 'raft' "$networkName" || { | |
echo "Failed to create a proposal for the new Raft implementation on $networkName" | |
exit 1 | |
} | |
# Add the contract name to the deployedContracts list | |
deployedContracts+=("Raft") | |
fi | |
if [ "$sdh_code_at_prev_tag" != "$latest_sdh_code" ]; then | |
implementationAddress=$(forge create src/SpecDataHolder.sol:SpecDataHolder --private-key "$DEPLOYER_PRIVATE_KEY" --verify --rpc-url "$rpc_url" --etherscan-api-key "$etherscan_api_key" | grep "Deployed to:" | cut -d " " -f 3) || { | |
echo "Failed to deploy the new SpecDataHolder implementation on $networkName" | |
exit 1 | |
} | |
echo "SDH contract deployed. implementationAddress: $implementationAddress" | |
node scripts/createProposal.js "$implementationAddress" 'specDataHolder' "$networkName" || { | |
echo "Failed to create a proposal for the new SpecDataHolder implementation on $networkName" | |
exit 1 | |
} | |
# Add the contract name to the deployedContracts list | |
deployedContracts+=("SpecDataHolder") | |
fi | |
# Check the deployment at the end of the loop | |
if [ ${#deployedContracts[@]} -gt 0 ]; then | |
echo "Successfully deployed: ${#deployedContracts[@]} contract(s) (${deployedContracts[*]}) on $networkName" | |
else | |
echo "No implementations deployed on $networkName" | |
fi | |
done |