@@ -3,12 +3,6 @@ name: Reusable Docker build and push workflow
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
- old_registry :
7
- required : true
8
- type : string
9
- old_username :
10
- required : true
11
- type : string
12
6
new_registry :
13
7
required : true
14
8
type : string
37
31
- name : Checkout
38
32
uses : actions/checkout@v4
39
33
40
- # Login for 'main' branch to both registries
41
- - name : Docker Login to fruoccopublic (Main)
42
- if : ${{ inputs.push == true && github.ref_name == 'main' }}
43
- uses : docker/login-action@v3
44
- with :
45
- registry : ${{ inputs.old_registry }}
46
- username : ${{ inputs.old_username }}
47
- password : ${{ secrets.DOCKER_PASSWORD }}
48
-
49
34
- name : Docker Login to cwydcontainerreg (Main)
50
35
if : ${{ inputs.push == true && github.ref_name == 'main' }}
51
36
uses : docker/login-action@v3
70
55
id : date
71
56
run : echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
72
57
73
- - name : Build Docker Image and optionally push (Old Registry)
74
- if : ${{ github.ref_name == 'main' }}
75
- uses : docker/build-push-action@v6
76
- with :
77
- context : .
78
- file : ${{ inputs.dockerfile }}
79
- push : ${{ inputs.push }}
80
- cache-from : type=registry,ref=${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || github.ref_name }}
81
- tags : |
82
- ${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || 'default' }}
83
- ${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ steps.date.outputs.date }}_${{ github.run_number }}
84
-
85
58
- name : Build Docker Image and optionally push (New Registry)
86
59
if : ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo'|| github.ref_name == 'dependabotchanges' }}
87
60
uses : docker/build-push-action@v6
0 commit comments