Skip to content

Commit 25f52ae

Browse files
ci: add docker build step and auto-generate image tag from dapp version
1 parent 4c81ec8 commit 25f52ae

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

.github/workflows/dapp-deploy.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ on:
1010
options:
1111
- dapp-dev
1212
- dapp-prod
13-
image-tag:
14-
description: 'Tag for the dapp image to sconify'
15-
required: true
16-
type: string
17-
default: 'latest'
1813
sconify-version:
1914
description: 'Version of the sconify image to use'
2015
type: string
@@ -24,11 +19,50 @@ env:
2419
DEPLOY_ENVIRONMENT: ${{ inputs.environment }}
2520

2621
jobs:
22+
build-and-push:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
image-name: ${{ steps.build.outputs.image-name }}
26+
image-tag: ${{ steps.build.outputs.image-tag }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Login to DockerHub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_PAT }}
39+
40+
- name: Get dapp version
41+
id: version
42+
run: |
43+
VERSION=$(node -p "require('./dapp/package.json').version")
44+
echo "version=$VERSION" >> $GITHUB_OUTPUT
45+
echo "dapp-version=$VERSION"
46+
47+
- name: Build and push Docker image
48+
id: build
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: ./dapp
52+
push: true
53+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/product/web3telegram-dapp:${{ steps.version.outputs.version }}-non-tee
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
outputs:
57+
image-name: ${{ secrets.DOCKERHUB_USERNAME }}/product/web3telegram-dapp
58+
image-tag: ${{ steps.version.outputs.version }}-non-tee
59+
2760
sconify:
61+
needs: build-and-push
2862
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/sconify.yml@sconify-v2
2963
with:
30-
image-name: product/web3telegram-dapp
31-
image-tag: ${{ inputs.image-tag }}
64+
image-name: ${{ needs.build-and-push.outputs.image-name }}
65+
image-tag: ${{ needs.build-and-push.outputs.image-tag }}
3266
sconify-debug: false
3367
sconify-prod: true
3468
docker-registry: docker.io
@@ -70,7 +104,7 @@ jobs:
70104
71105
deploy-dapp:
72106
runs-on: ubuntu-latest
73-
needs: sconify
107+
needs: [build-and-push, sconify]
74108
steps:
75109
- name: Checkout code
76110
uses: actions/checkout@v4

0 commit comments

Comments
 (0)