forked from NethermindEth/nethermind
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (60 loc) · 3 KB
/
build-nethermind-docker-images.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
name: '[BUILD] Docker images and publish to Docker Hub'
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the nethermind/nethermind docker image'
required: false
default: ''
jobs:
build-dockers:
if: github.repository_owner == 'NethermindEth'
runs-on: ubuntu-latest
steps:
- name: Import Secrets
uses: hashicorp/vault-action@v2.1.2
with:
url: ${{ secrets.VAULT_URL }}
method: approle
roleId: ${{ secrets.ROLE_ID }}
secretId: ${{ secrets.SECRET_ID }}
namespace: admin/NethermindEth
secrets: |
github/nethermind/data/environments/release DOCKER_USERNAME ;
github/nethermind/data/environments/release DOCKER_PASSWORD ;
github/nethermind/data/secrets REPOSITORY_DISPATCH_TOKEN
- name: Checking out repository
uses: actions/checkout@v2
- name: Unshallow fetching
run: git fetch --unshallow
- name: Settings
id: settings
run: |
echo ::set-output name=TAG::${{ github.event.inputs.tag }}
echo ::set-output name=TAG_FROM_REPO::$(git describe --tags --always | cut -d- -f1)
echo ::set-output name=docker_username::${{ env.DOCKER_USERNAME }}
echo ::set-output name=docker_image::nethermind/nethermind
- name: Setting up QEMU
uses: docker/setup-qemu-action@v1
- name: Setting up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Logging to Docker Hub
if: success()
env:
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.settings.outputs.docker_username }}" --password-stdin
- name: Building & Pushing image to docker registry (major) / trigger DAppNode Build
if: steps.settings.outputs.TAG == steps.settings.outputs.TAG_FROM_REPO
run: |
docker buildx build --platform=linux/amd64,linux/arm64 -t "${{ steps.settings.outputs.docker_image }}:latest" -t "${{ steps.settings.outputs.docker_image }}:${{ steps.settings.outputs.TAG }}" -f Dockerfile --build-arg GIT_COMMIT=$(git log -1 --format=%h) . --push
curl -v -X POST -u "${{ env.REPOSITORY_DISPATCH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type":"dappnode", "client_payload": { "tag":"${{ steps.settings.outputs.TAG }}"}}' https://api.github.com/repos/nethermindeth/nethermind/dispatches
- name: Building & Pushing image to docker registry (patch)
if: steps.settings.outputs.TAG != steps.settings.outputs.TAG_FROM_REPO
run: |
docker buildx build --platform=linux/amd64,linux/arm64 -t "${{ steps.settings.outputs.docker_image }}:${{ steps.settings.outputs.TAG }}" -f Dockerfile --build-arg GIT_COMMIT=$(git log -1 --format=%h) . --push
- name: Clearing
if: always()
run: |
rm -f ${HOME}/.docker/config.json