forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 41
92 lines (86 loc) · 2.82 KB
/
nightly_zkevm.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Nightly - Build and Push Docker
on:
schedule:
- cron: '0 0 * * *' # Runs every night at midnight UTC
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_NAME: hermeznetwork/cdk-erigon
jobs:
prepare:
if: github.ref == 'refs/heads/zkevm'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.prep.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare
id: prep
run: |
SHORT_SHA=$(echo ${{ github.sha }} | head -c 7)
DATE_TIME=$(date +"%Y%m%d%H%M%S")
TAG=$DATE_TIME-$SHORT_SHA
echo "version=$TAG" >> $GITHUB_OUTPUT
build-amd64:
if: github.ref == 'refs/heads/zkevm'
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Build and push AMD64 image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }}-amd64
platforms: linux/amd64
build-arm64:
if: github.ref == 'refs/heads/zkevm'
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Build and push ARM64 image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }}-arm64
platforms: linux/arm64
create-and-push-manifest:
if: github.ref == 'refs/heads/zkevm'
needs: [prepare, build-amd64, build-arm64]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Create and push manifest
run: |
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 --tag ${{ env.IMAGE_NAME }}:${{ needs.prepare.outputs.version }} --file Dockerfile .