Skip to content

Commit b96486d

Browse files
committed
Update docker build & push workflow:
* ci.yml will tag it's image as 'unstable' * pre-release.yml will rebuild the images tagged as 'pre-release' using the git tag commit artifacts * release.yml will do the same as pre-release but tagged as 'latest'
1 parent 47a6b4a commit b96486d

File tree

3 files changed

+113
-1
lines changed

3 files changed

+113
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ jobs:
391391
with:
392392
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
393393
tags: |
394-
latest
394+
unstable
395395
type=raw,value={{branch}}-{{sha}}
396396
397397
- name: Download ${{ matrix.project }} executable

.github/workflows/pre-release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,66 @@ jobs:
7676
prerelease: true
7777
title: Mithril v${{ github.ref_name }}
7878
files: build/**/*
79+
80+
build-push-docker:
81+
runs-on: ubuntu-22.04
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
project: [ mithril-aggregator, mithril-client, mithril-signer ]
86+
87+
permissions:
88+
contents: read
89+
packages: write
90+
91+
env:
92+
REGISTRY: ghcr.io
93+
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.project }}
94+
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
95+
CONTEXT: .
96+
GITHUB_REF: ${{ github.ref}}
97+
98+
steps:
99+
- name: Checkout
100+
uses: actions/checkout@v3
101+
102+
- name: Log in to the Container registry
103+
uses: docker/login-action@v2
104+
with:
105+
registry: ${{ env.REGISTRY }}
106+
username: ${{ github.actor }}
107+
password: ${{ secrets.GITHUB_TOKEN }}
108+
109+
- name: Extract metadata (tags, labels) for Docker
110+
id: meta
111+
uses: docker/metadata-action@v4
112+
with:
113+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
114+
tags: |
115+
pre-release
116+
type=raw,value={{branch}}-{{sha}}
117+
118+
- name: Download ${{ matrix.project }} artifacts
119+
uses: dawidd6/action-download-artifact@v2
120+
with:
121+
name: ${{ matrix.project }}-Linux-x64
122+
path: ${{ matrix.project }}
123+
commit: ${{ github.sha }}
124+
workflow: ci.yml
125+
workflow_conclusion: success
126+
127+
- name: Build and push Docker image
128+
uses: docker/build-push-action@v3
129+
with:
130+
context: ${{ env.CONTEXT }}
131+
file: ${{ env.DOCKER_FILE }}
132+
push: true
133+
tags: ${{ steps.meta.outputs.tags }}
79134

80135
deploy-pre-release:
81136
runs-on: ubuntu-22.04
137+
needs:
138+
- build-push-docker
82139
steps:
83140
- name: TODO
84141
run: echo "Add terraform deployment to a pre-release environment here"

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,61 @@ on:
55
types: [released]
66

77
jobs:
8+
build-push-docker:
9+
runs-on: ubuntu-22.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
project: [ mithril-aggregator, mithril-client, mithril-signer ]
14+
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.project }}
22+
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
23+
CONTEXT: .
24+
GITHUB_REF: ${{ github.ref}}
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@v4
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
tags: |
43+
latest
44+
type=raw,value={{branch}}-{{sha}}
45+
46+
- name: Download ${{ matrix.project }} artifacts
47+
uses: dawidd6/action-download-artifact@v2
48+
with:
49+
name: ${{ matrix.project }}-Linux-x64
50+
path: ${{ matrix.project }}
51+
commit: ${{ github.sha }}
52+
workflow: ci.yml
53+
workflow_conclusion: success
54+
55+
- name: Build and push Docker image
56+
uses: docker/build-push-action@v3
57+
with:
58+
context: ${{ env.CONTEXT }}
59+
file: ${{ env.DOCKER_FILE }}
60+
push: true
61+
tags: ${{ steps.meta.outputs.tags }}
62+
863
deploy-release:
964
runs-on: ubuntu-22.04
1065
steps:

0 commit comments

Comments
 (0)