Skip to content

Commit

Permalink
ci: add deployment workflow for ERC-20 token
Browse files Browse the repository at this point in the history
build: set up Etherscan API and Infura PRC in Foundry config
chore: add mnemonic in ".env.example"
  • Loading branch information
PaulRBerg committed Mar 15, 2023
1 parent 766cb21 commit 2138406
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export ETH_FROM="YOUR_DEFAULT_SENDER_ACCOUNT"
export ETH_RPC_URL="https://rinkeby.infura.io/v3/INFURA_API_KEY"
API_KEY_ETHERSCAN="YOUR_API_KEY_ETHERSCAN"
API_KEY_INFURA="YOUR_API_KEY_INFURA"
MNEMONIC="YOUR_MNEMONIC"
36 changes: 36 additions & 0 deletions .github/workflows/deploy-test-token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Deploy Test Token"

env:
API_KEY_ETHERSCAN: ${{ secrets.API_KEY_ETHERSCAN }}
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
MNEMONIC: ${{ secrets.MNEMONIC }}

on:
workflow_dispatch:
inputs:
chain:
default: "goerli"
description: 'Chain name. Defaults to "goerli" if unspecified'
required: false

jobs:
deploy-test-token:
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Deploy a test ERC-20 token contract"
run: >-
forge script script/deploy/DeployTestToken.s.sol --broadcast --rpc-url "${{ github.event.inputs.chain }}"
-vvvv
- name: "Add summary"
run: |
echo "## Deployment result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
11 changes: 11 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
[profile.ci]
fuzz = { runs = 10_000 }

[etherscan]
ethereum = { key = "${API_KEY_ETHERSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }

[fmt]
bracket_spacing = true
int_types = "long"
Expand All @@ -30,3 +35,9 @@
quote_style = "double"
tab_width = 4
wrap_comments = true

[rpc_endpoints]
ethereum = "https://mainnet.infura.io/v3/${API_KEY_INFURA}"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"

0 comments on commit 2138406

Please sign in to comment.