forked from pinax-network/firehose-antelope
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (87 loc) · 3.66 KB
/
dockerimage.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
93
94
95
96
97
98
99
100
101
name: Docker Image CI
run-name: Build image with firehose-antelope:'${{ github.event.inputs.firehose-antelope }}' and eosio:'${{ github.event.inputs.eosio }}'
on:
# Only allows triggering through the Github Workflow UI
workflow_dispatch:
inputs:
firehose-antelope:
description: Tag from firehose-antelope
required: true
type: string
eosio:
description: Tag from eosio
required: false
type: string
overwrite:
description: Overwrite existed firehose-antelope image.
default: false
type: boolean
env:
DOCKER_IMAGE: eu.gcr.io/dfuse-302310/firehose-antelope
jobs:
build:
name: Build and Push Image
runs-on: ubuntu-latest
steps:
- name: Set firehose-antelope tag
run: |
echo "FIREHOSE_TAG=${{ github.event.inputs.firehose-antelope }}" >> $GITHUB_ENV
- name: Set nodeos version
if: ${{ github.event.inputs.eosio != 'null' }}
run: |
echo "EOSIO_TAG=${{ github.event.inputs.eosio }}" >> $GITHUB_ENV
echo "FIREHOSE_NODEOS_TAG=${{ github.event.inputs.firehose-antelope }}-nodeos${{ github.event.inputs.eosio }}" >> $GITHUB_ENV
# checkout based on firehose-antelope tag
- name: Checkout firehose-antelope
uses: actions/checkout@v3
with:
ref: "${{ env.FIREHOSE_TAG }}"
# check release commit
- name: Update Commit Hash
run: |
echo "RELEASE_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Only download eosio if set
- name: Download EOSIO Debian package
if: ${{ github.event.inputs.eosio != 'null' }}
uses: Legion2/download-release-action@v2.1.0
with:
repository: ultraio/eosio
tag: '${{ github.event.inputs.eosio }}'
path: .
file: eosio-${{ env.EOSIO_TAG }}.deb
token: '${{ secrets.BLOCKCHAIN_CI_SECRET }}'
# gcloud authorization
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCR_KEY }}'
- name: Setup gcloud cli
uses: google-github-actions/setup-gcloud@v1
with:
project_id: dfuse-302310
# docker gcloud config
- name: Docker config
run: |
gcloud auth configure-docker -q
# Check if firehose image is existed. Failed if not existed
- name: Check Firehose Image
id: firehose-check
continue-on-error: true
run: |
docker manifest inspect ${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_TAG }}
# Only build firehose-antelope image if not existed or overwrite is set
- name: Build firehose-antelope Image Without Nodeos
if: ${{ (steps.firehose-check.outcome == 'failure' || github.event.inputs.overwrite == 'true') }}
run: |
docker build -f firehose.Dockerfile . -t ${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_TAG }} \
--build-arg VERSION=${{ env.FIREHOSE_TAG }} \
--build-arg COMMIT=${{ env.RELEASE_COMMIT }}
docker push ${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_TAG }}
# Only build firehose-antelope with nodeos if eosio is set and firehose-antelope image are exist
- name: Build firehose-antelope Image With Nodeos
if: ${{ github.event.inputs.eosio != 'null' }}
run: |
docker build -f nodeos.Dockerfile . -t ${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_NODEOS_TAG }} \
--build-arg FIREHOSE_IMAGE=${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_TAG }} \
--build-arg DEB_PKG=eosio-${{ env.EOSIO_TAG }}.deb
docker push ${{ env.DOCKER_IMAGE }}:${{ env.FIREHOSE_NODEOS_TAG }}