@@ -2,35 +2,57 @@ name: Build and Push Docker Image
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - dev
5
7
tags :
6
8
- ' v*' # Trigger on tags'
7
9
8
10
jobs :
9
11
build-and-push :
10
12
runs-on : ubuntu-latest
11
13
steps :
12
- # Step 1: Checkout the repository code
13
14
- name : Checkout repository
14
15
uses : actions/checkout@v3
15
16
16
- # Step 2: Set up QEMU for multi-platform builds
17
+ - id : commit
18
+ uses : prompt/actions-commit-hash@v3
19
+
17
20
- name : Set up QEMU
18
21
uses : docker/setup-qemu-action@v2
19
22
with :
20
23
platforms : linux/amd64,linux/arm64
21
24
22
- # Step 3: Set up Docker Buildx
23
25
- name : Set up Docker Buildx
24
26
uses : docker/setup-buildx-action@v2
25
27
26
- # Step 4: Log in to Docker Hub
27
28
- name : Log in to Docker Hub
28
29
uses : docker/login-action@v2
29
30
with :
30
31
username : ${{ secrets.DOCKERHUB_USERNAME }}
31
32
password : ${{ secrets.DOCKERHUB_TOKEN }}
32
33
33
- # Step 5: Build and push the Docker image
34
+ # Build and push the Docker image (dev)
35
+ - name : Build and push Docker image (dev)
36
+ if : github.ref == 'refs/heads/dev'
37
+ uses : docker/build-push-action@v4
38
+ with :
39
+ context : .
40
+ platforms : linux/amd64,linux/arm64
41
+ push : true
42
+ build-args : --progress=plain
43
+ tags : setavenger/blindbit-oracle:dev-${{ steps.commit.outputs.short }} # Use the short SHA to distinguish dev images
44
+
45
+ # Build and push the Docker image (tags)
46
+ - name : Build and push Docker image
47
+ if : startsWith(github.ref, 'refs/tags/')
48
+ uses : docker/build-push-action@v4
49
+ with :
50
+ context : .
51
+ platforms : linux/amd64,linux/arm64
52
+ push : true
53
+ build-args : --progress=plain
54
+ tags : setavenger/blindbit-oracle:${{ github.ref_name }}
55
+
34
56
- name : Build and push Docker image
35
57
uses : docker/build-push-action@v4
36
58
with :
0 commit comments