forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (44 loc) · 1.68 KB
/
deploy-hardhat.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Deploying hardhat
on:
pull_request:
branches: ["master"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: san-est/go-ethereum-devops
jobs:
deploy-hardhat:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Pull image
run: docker pull ghcr.io/san-est/go-ethereum-devops:9
- name: Running image container
run: |
docker run -d --name devnet -p 8545:8545 -v ${{ github.workspace }}/hardhat:/workspace/hardhat ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:9
- name: Installing Node.js, npm and local hardhat so that hardhat sample can run
run: |
docker exec devnet apk add --no-cache nodejs npm
docker exec devnet sh -c "cd /workspace/hardhat && npm install
- name: Deploy hardhat sample project
run: |
docker exec devnet npx hardhat compile --config /workspace/hardhat/hardhat.config.js
docker exec devnet npx hardhat run /workspace/hardhat/scripts/deploy.js --network devnet
- name: Build a new docker image
run: |
docker commit devnet go-eth-hardhat:latest
docker tag go-eth-hardhat:latest ${{ env.REGISTRY }}/${{ github.repository_owner }}/go-eth-hardhat:latest
- name: Push new image to ghcr.io
run: docker push ${{ env.REGISTRY }}/${{ github.repository_owner }}/go-eth-hardhat:latest