@@ -2,13 +2,19 @@ name: 'ACR: Docker Push'
2
2
3
3
on :
4
4
workflow_call :
5
-
5
+ inputs :
6
+ image_tag :
7
+ description : ' Image Tag (semantic version)'
8
+ required : false
9
+ default : null
10
+ type : string
6
11
7
12
jobs :
8
- az-acr-push :
13
+ az-acr-push-dev :
9
14
name : " Azure: ACR Build & Push"
10
15
runs-on : ubuntu-latest
11
16
environment : dev
17
+ if : github.event.inputs.image_tag == null
12
18
env :
13
19
DOCKERFILE : ${{ vars.DOCKERFILE || 'Dockerfile' }}
14
20
AZURE_CONTAINER_REGISTRY : ${{ secrets.AZURE_CONTAINER_REGISTRY }}
@@ -39,13 +45,44 @@ jobs:
39
45
push : true
40
46
build-args : platform=linux/${{ matrix.platform}}
41
47
42
- # - name: Build & Push - Replace branch
43
- # if: ${{ github.ref != github.repository.default_branch }}
44
- # uses: docker/build-push-action@v5
45
- # with:
46
- # push: true
47
- # file: ${{ env.DOCKERFILE }}
48
- # tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ matrix.platform}}-${{ github.ref_name }}
49
- # cache-from: type=gha
50
- # cache-to: type=gha,mode=max
51
- # build-args: platform=linux/${{ matrix.platform}}
48
+ - name : Build & Push - Replace branch
49
+ if : ${{ github.ref != github.repository.default_branch }}
50
+ uses : docker/build-push-action@v5
51
+ with :
52
+ push : true
53
+ file : ${{ env.DOCKERFILE }}
54
+ tags : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ matrix.platform}}-${{ github.ref_name }}
55
+ cache-from : type=gha
56
+ cache-to : type=gha,mode=max
57
+ build-args : platform=linux/${{ matrix.platform}}
58
+
59
+
60
+ az-acr-push-prod :
61
+ name : " Azure: ACR Build & Push"
62
+ runs-on : ubuntu-latest
63
+ environment : prod
64
+ if : github.event.inputs.image_tag != null
65
+ env :
66
+ AZURE_CONTAINER_REGISTRY : ${{ secrets.AZURE_CONTAINER_REGISTRY }}
67
+ ACR_LOGIN_USERNAME : ${{ secrets.ACR_LOGIN_USERNAME }}
68
+ ACR_LOGIN_PASSWORD : ${{ secrets.ACR_LOGIN_PASSWORD }}
69
+ steps :
70
+ - name : Checkout repository
71
+ uses : actions/checkout@v4
72
+ - name : Set up Docker Buildx
73
+ uses : docker/setup-buildx-action@v3
74
+ - name : Log into registry
75
+ uses : docker/login-action@v3
76
+ with :
77
+ registry : " ${{ env.AZURE_CONTAINER_REGISTRY }}"
78
+ username : " ${{ env.ACR_LOGIN_USERNAME }}"
79
+ password : " ${{ env.ACR_LOGIN_PASSWORD }}"
80
+
81
+ - name : Build & Push
82
+ uses : docker/build-push-action@v5
83
+ with :
84
+ push : true
85
+ file : Dockerfile
86
+ tags : ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ github.event.repository.name }}:${{ github.event.inputs.image_tag }}
87
+ build-args : platform=linux/amd64
88
+
0 commit comments