求适用于eth-brownie==1.19.3的Github Actions部署Workflow.yaml文件
Github Actions Workflow for eth-brownie Sepolia Deployment
Here's a complete workflow.yaml configuration file tailored for your eth-brownie 1.19.3 setup:
name: Deploy to Sepolia Testnet on: push: branches: [ main ] # Trigger deployment on push to main branch (adjust to your target branch) jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python 3.10 uses: actions/setup-python@v5 with: python-version: "3.10" # Verified compatible with eth-brownie 1.19.3 - name: Install dependencies run: | python -m pip install --upgrade pip pip install eth-brownie==1.19.3 npm install -g ganache-cli # Optional, only needed if your deployment relies on local testing - name: Configure Sepolia network (if not pre-configured in brownie) run: | brownie networks add Ethereum sepolia host=https://sepolia.infura.io/v3/${{ secrets.INFURA_PROJECT_ID }} chainid=11155111 explorer=https://api-sepolia.etherscan.io/api - name: Deploy contract to Sepolia env: PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} run: | brownie run scripts/deploy.py --network sepolia
Critical Pre-Workflow Setup
Add Repository Secrets:
- Go to your repo → Settings → Secrets and variables → Actions → New repository secret
- Create
PRIVATE_KEY: Private key of your Sepolia-funded Ethereum account (never commit this to code) - Create
INFURA_PROJECT_ID: Your Infura project ID (sign up for free if you don't have one)
Adjust Deployment Script Path:
- Update
scripts/deploy.pyin thebrownie runcommand to match your actual deployment script's location/name
- Update
Security Best Practices:
- Restrict push permissions to your target branch to prevent unauthorized deployments
- For production-like setups, add a manual approval step by adding
environment: productionto the job and configuring environment protection rules in Github settings
内容的提问来源于stack exchange,提问作者Matt - Block-Farms.io
相关产品推荐
相关产品推荐

