mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
deploy with sample hardhat project
This commit is contained in:
parent
a547cad3b8
commit
f3e17aa09a
1 changed files with 62 additions and 0 deletions
62
.github/workflows/deploy-devnet.yml
vendored
Normal file
62
.github/workflows/deploy-devnet.yml
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
name: Deploy Hardhat Project to Devnet and Save Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [closed]
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-hardhat:
|
||||||
|
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Deploy')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
BASE_IMAGE: yohands/my_first_container:latest
|
||||||
|
FINAL_IMAGE: yohands/my_first_container:with-contracts
|
||||||
|
CONTAINER_NAME: devnet-node
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Start devnet with go-ethereum image
|
||||||
|
run: |
|
||||||
|
docker run -d \
|
||||||
|
--name $CONTAINER_NAME \
|
||||||
|
-p 8545:8545 \
|
||||||
|
$BASE_IMAGE \
|
||||||
|
--dev --http --http.api eth,net,web3,personal
|
||||||
|
|
||||||
|
# Give devnet time to start up
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Install Hardhat dependencies
|
||||||
|
working-directory: ./hardhat
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Deploy contracts to devnet
|
||||||
|
working-directory: ./hardhat
|
||||||
|
run: npx hardhat run scripts/deploy.js --network localhost
|
||||||
|
|
||||||
|
- name: Commit container with deployed contracts
|
||||||
|
run: |
|
||||||
|
docker commit $CONTAINER_NAME $FINAL_IMAGE
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Push image to Docker Hub
|
||||||
|
run: |
|
||||||
|
docker push $FINAL_IMAGE
|
||||||
Loading…
Reference in a new issue